Fix static / version based BWC tests (elastic/x-pack-elasticsearch#1456)
With the leniency in Version.java we missed to really setup BWC testing for static indices. This change brings back the testing and adds missing bwc indices. Relates to elastic/elasticsearch#24732 Original commit: elastic/x-pack-elasticsearch@85e6270338
This commit is contained in:
parent
bfc3779f51
commit
d2e1b31bc7
|
@ -235,7 +235,7 @@ public class XPackInfoResponse extends ActionResponse {
|
||||||
|
|
||||||
public FeatureSet(StreamInput in) throws IOException {
|
public FeatureSet(StreamInput in) throws IOException {
|
||||||
this(in.readString(), in.readOptionalString(), in.readBoolean(), in.readBoolean(),
|
this(in.readString(), in.readOptionalString(), in.readBoolean(), in.readBoolean(),
|
||||||
in.getVersion().onOrAfter(Version.V_5_4_0_UNRELEASED) ? in.readMap() : null);
|
in.getVersion().onOrAfter(Version.V_5_4_0) ? in.readMap() : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FeatureSet(String name, @Nullable String description, boolean available, boolean enabled,
|
public FeatureSet(String name, @Nullable String description, boolean available, boolean enabled,
|
||||||
|
@ -287,7 +287,7 @@ public class XPackInfoResponse extends ActionResponse {
|
||||||
out.writeOptionalString(description);
|
out.writeOptionalString(description);
|
||||||
out.writeBoolean(available);
|
out.writeBoolean(available);
|
||||||
out.writeBoolean(enabled);
|
out.writeBoolean(enabled);
|
||||||
if (out.getVersion().onOrAfter(Version.V_5_4_0_UNRELEASED)) {
|
if (out.getVersion().onOrAfter(Version.V_5_4_0)) {
|
||||||
out.writeMap(nativeCodeInfo);
|
out.writeMap(nativeCodeInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,7 @@ public class MlMetadata implements MetaData.Custom {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Version getMinimalSupportedVersion() {
|
public Version getMinimalSupportedVersion() {
|
||||||
return Version.V_5_4_0_UNRELEASED;
|
return Version.V_5_4_0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class MonitoringBulkDoc extends MonitoringDoc implements Writeable {
|
||||||
String id = in.readOptionalString();
|
String id = in.readOptionalString();
|
||||||
BytesReference source = in.readBytesReference();
|
BytesReference source = in.readBytesReference();
|
||||||
XContentType xContentType;
|
XContentType xContentType;
|
||||||
if (source != BytesArray.EMPTY && in.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) {
|
if (source != BytesArray.EMPTY && in.getVersion().onOrAfter(Version.V_5_3_0)) {
|
||||||
xContentType = XContentType.readFrom(in);
|
xContentType = XContentType.readFrom(in);
|
||||||
} else {
|
} else {
|
||||||
xContentType = XContentFactory.xContentType(source);
|
xContentType = XContentFactory.xContentType(source);
|
||||||
|
@ -84,7 +84,7 @@ public class MonitoringBulkDoc extends MonitoringDoc implements Writeable {
|
||||||
out.writeOptionalString(type);
|
out.writeOptionalString(type);
|
||||||
out.writeOptionalString(id);
|
out.writeOptionalString(id);
|
||||||
out.writeBytesReference(source);
|
out.writeBytesReference(source);
|
||||||
if (source != null && source != BytesArray.EMPTY && out.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) {
|
if (source != null && source != BytesArray.EMPTY && out.getVersion().onOrAfter(Version.V_5_3_0)) {
|
||||||
xContentType.writeTo(out);
|
xContentType.writeTo(out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -183,7 +183,7 @@ public final class PersistentTasksCustomMetaData extends AbstractNamedDiffable<M
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Version getMinimalSupportedVersion() {
|
public Version getMinimalSupportedVersion() {
|
||||||
return Version.V_5_4_0_UNRELEASED;
|
return Version.V_5_4_0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -25,7 +25,6 @@ import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
import org.elasticsearch.common.xcontent.XContentType;
|
import org.elasticsearch.common.xcontent.XContentType;
|
||||||
import org.elasticsearch.common.xcontent.json.JsonXContent;
|
import org.elasticsearch.common.xcontent.json.JsonXContent;
|
||||||
import org.elasticsearch.xpack.common.xcontent.XContentUtils;
|
import org.elasticsearch.xpack.common.xcontent.XContentUtils;
|
||||||
import org.elasticsearch.xpack.security.authz.privilege.ClusterPrivilege;
|
|
||||||
import org.elasticsearch.xpack.security.support.MetadataUtils;
|
import org.elasticsearch.xpack.security.support.MetadataUtils;
|
||||||
import org.elasticsearch.xpack.security.support.Validation;
|
import org.elasticsearch.xpack.security.support.Validation;
|
||||||
|
|
||||||
|
@ -179,7 +178,7 @@ public class RoleDescriptor implements ToXContentObject {
|
||||||
Map<String, Object> metadata = in.readMap();
|
Map<String, Object> metadata = in.readMap();
|
||||||
|
|
||||||
final Map<String, Object> transientMetadata;
|
final Map<String, Object> transientMetadata;
|
||||||
if (in.getVersion().onOrAfter(Version.V_5_2_0_UNRELEASED)) {
|
if (in.getVersion().onOrAfter(Version.V_5_2_0)) {
|
||||||
transientMetadata = in.readMap();
|
transientMetadata = in.readMap();
|
||||||
} else {
|
} else {
|
||||||
transientMetadata = Collections.emptyMap();
|
transientMetadata = Collections.emptyMap();
|
||||||
|
@ -196,7 +195,7 @@ public class RoleDescriptor implements ToXContentObject {
|
||||||
}
|
}
|
||||||
out.writeStringArray(descriptor.runAs);
|
out.writeStringArray(descriptor.runAs);
|
||||||
out.writeMap(descriptor.metadata);
|
out.writeMap(descriptor.metadata);
|
||||||
if (out.getVersion().onOrAfter(Version.V_5_2_0_UNRELEASED)) {
|
if (out.getVersion().onOrAfter(Version.V_5_2_0)) {
|
||||||
out.writeMap(descriptor.transientMetadata);
|
out.writeMap(descriptor.transientMetadata);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,7 +94,7 @@ public class SecurityServerTransportInterceptor extends AbstractComponent implem
|
||||||
securityContext.executeAsUser(SystemUser.INSTANCE, (original) -> sendWithUser(connection, action, request, options,
|
securityContext.executeAsUser(SystemUser.INSTANCE, (original) -> sendWithUser(connection, action, request, options,
|
||||||
new ContextRestoreResponseHandler<>(threadPool.getThreadContext().wrapRestorable(original)
|
new ContextRestoreResponseHandler<>(threadPool.getThreadContext().wrapRestorable(original)
|
||||||
, handler), sender), connection.getVersion());
|
, handler), sender), connection.getVersion());
|
||||||
} else if (reservedRealmEnabled && connection.getVersion().before(Version.V_5_2_0_UNRELEASED) &&
|
} else if (reservedRealmEnabled && connection.getVersion().before(Version.V_5_2_0) &&
|
||||||
KibanaUser.NAME.equals(securityContext.getUser().principal())) {
|
KibanaUser.NAME.equals(securityContext.getUser().principal())) {
|
||||||
final User kibanaUser = securityContext.getUser();
|
final User kibanaUser = securityContext.getUser();
|
||||||
final User bwcKibanaUser = new User(kibanaUser.principal(), new String[] { "kibana" }, kibanaUser.fullName(),
|
final User bwcKibanaUser = new User(kibanaUser.principal(), new String[] { "kibana" }, kibanaUser.fullName(),
|
||||||
|
|
|
@ -124,7 +124,7 @@ public interface ServerTransportFilter {
|
||||||
}
|
}
|
||||||
|
|
||||||
authcService.authenticate(securityAction, request, null, ActionListener.wrap((authentication) -> {
|
authcService.authenticate(securityAction, request, null, ActionListener.wrap((authentication) -> {
|
||||||
if (reservedRealmEnabled && authentication.getVersion().before(Version.V_5_2_0_UNRELEASED) &&
|
if (reservedRealmEnabled && authentication.getVersion().before(Version.V_5_2_0) &&
|
||||||
KibanaUser.NAME.equals(authentication.getUser().authenticatedUser().principal())) {
|
KibanaUser.NAME.equals(authentication.getUser().authenticatedUser().principal())) {
|
||||||
executeAsCurrentVersionKibanaUser(securityAction, request, transportChannel, listener, authentication);
|
executeAsCurrentVersionKibanaUser(securityAction, request, transportChannel, listener, authentication);
|
||||||
} else if (securityAction.equals(TransportService.HANDSHAKE_ACTION_NAME) &&
|
} else if (securityAction.equals(TransportService.HANDSHAKE_ACTION_NAME) &&
|
||||||
|
|
|
@ -15,7 +15,7 @@ public class LogstashSystemUser extends User {
|
||||||
|
|
||||||
public static final String NAME = "logstash_system";
|
public static final String NAME = "logstash_system";
|
||||||
private static final String ROLE_NAME = "logstash_system";
|
private static final String ROLE_NAME = "logstash_system";
|
||||||
public static final Version DEFINED_SINCE = Version.V_5_2_0_UNRELEASED;
|
public static final Version DEFINED_SINCE = Version.V_5_2_0;
|
||||||
public static final BuiltinUserInfo USER_INFO = new BuiltinUserInfo(NAME, ROLE_NAME, DEFINED_SINCE);
|
public static final BuiltinUserInfo USER_INFO = new BuiltinUserInfo(NAME, ROLE_NAME, DEFINED_SINCE);
|
||||||
|
|
||||||
public LogstashSystemUser(boolean enabled) {
|
public LogstashSystemUser(boolean enabled) {
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.xpack.security.user;
|
package org.elasticsearch.xpack.security.user;
|
||||||
|
|
||||||
import org.elasticsearch.ElasticsearchSecurityException;
|
|
||||||
import org.elasticsearch.Version;
|
import org.elasticsearch.Version;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
|
@ -197,7 +196,7 @@ public class User implements ToXContentObject {
|
||||||
boolean hasInnerUser = input.readBoolean();
|
boolean hasInnerUser = input.readBoolean();
|
||||||
if (hasInnerUser) {
|
if (hasInnerUser) {
|
||||||
User innerUser = readFrom(input);
|
User innerUser = readFrom(input);
|
||||||
if (input.getVersion().onOrBefore(Version.V_5_4_0_UNRELEASED)) {
|
if (input.getVersion().onOrBefore(Version.V_5_4_0)) {
|
||||||
// backcompat: runas user was read first, so reverse outer and inner
|
// backcompat: runas user was read first, so reverse outer and inner
|
||||||
return new User(innerUser, outerUser);
|
return new User(innerUser, outerUser);
|
||||||
} else {
|
} else {
|
||||||
|
@ -219,7 +218,7 @@ public class User implements ToXContentObject {
|
||||||
if (user.authenticatedUser == null) {
|
if (user.authenticatedUser == null) {
|
||||||
// no backcompat necessary, since there is no inner user
|
// no backcompat necessary, since there is no inner user
|
||||||
writeUser(user, output);
|
writeUser(user, output);
|
||||||
} else if (output.getVersion().onOrBefore(Version.V_5_4_0_UNRELEASED)) {
|
} else if (output.getVersion().onOrBefore(Version.V_5_4_0)) {
|
||||||
// backcompat: write runas user as the "inner" user
|
// backcompat: write runas user as the "inner" user
|
||||||
writeUser(user.authenticatedUser, output);
|
writeUser(user.authenticatedUser, output);
|
||||||
output.writeBoolean(true);
|
output.writeBoolean(true);
|
||||||
|
|
|
@ -240,7 +240,7 @@ public class ExecuteWatchRequest extends MasterNodeReadRequest<ExecuteWatchReque
|
||||||
}
|
}
|
||||||
if (in.readBoolean()) {
|
if (in.readBoolean()) {
|
||||||
watchSource = in.readBytesReference();
|
watchSource = in.readBytesReference();
|
||||||
if (in.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) {
|
if (in.getVersion().onOrAfter(Version.V_5_3_0)) {
|
||||||
xContentType = XContentType.readFrom(in);
|
xContentType = XContentType.readFrom(in);
|
||||||
} else {
|
} else {
|
||||||
xContentType = XContentFactory.xContentType(watchSource);
|
xContentType = XContentFactory.xContentType(watchSource);
|
||||||
|
@ -272,7 +272,7 @@ public class ExecuteWatchRequest extends MasterNodeReadRequest<ExecuteWatchReque
|
||||||
out.writeBoolean(watchSource != null);
|
out.writeBoolean(watchSource != null);
|
||||||
if (watchSource != null) {
|
if (watchSource != null) {
|
||||||
out.writeBytesReference(watchSource);
|
out.writeBytesReference(watchSource);
|
||||||
if (out.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) {
|
if (out.getVersion().onOrAfter(Version.V_5_3_0)) {
|
||||||
xContentType.writeTo(out);
|
xContentType.writeTo(out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,7 +125,7 @@ public class PutWatchRequest extends MasterNodeRequest<PutWatchRequest> {
|
||||||
id = in.readString();
|
id = in.readString();
|
||||||
source = in.readBytesReference();
|
source = in.readBytesReference();
|
||||||
active = in.readBoolean();
|
active = in.readBoolean();
|
||||||
if (in.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) {
|
if (in.getVersion().onOrAfter(Version.V_5_3_0)) {
|
||||||
xContentType = XContentType.readFrom(in);
|
xContentType = XContentType.readFrom(in);
|
||||||
} else {
|
} else {
|
||||||
xContentType = XContentFactory.xContentType(source);
|
xContentType = XContentFactory.xContentType(source);
|
||||||
|
@ -138,7 +138,7 @@ public class PutWatchRequest extends MasterNodeRequest<PutWatchRequest> {
|
||||||
out.writeString(id);
|
out.writeString(id);
|
||||||
out.writeBytesReference(source);
|
out.writeBytesReference(source);
|
||||||
out.writeBoolean(active);
|
out.writeBoolean(active);
|
||||||
if (out.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) {
|
if (out.getVersion().onOrAfter(Version.V_5_3_0)) {
|
||||||
xContentType.writeTo(out);
|
xContentType.writeTo(out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,7 +101,7 @@ public abstract class AbstractOldXPackIndicesBackwardsCompatibilityTestCase exte
|
||||||
SortedSet<String> expectedVersions = new TreeSet<>();
|
SortedSet<String> expectedVersions = new TreeSet<>();
|
||||||
for (Version v : VersionUtils.allReleasedVersions()) {
|
for (Version v : VersionUtils.allReleasedVersions()) {
|
||||||
if (false == shouldTestVersion(v)) continue;
|
if (false == shouldTestVersion(v)) continue;
|
||||||
if (v.before(Version.V_5_0_0)) continue; // we can only support one major version backward
|
if (v.before(Version.CURRENT.minimumIndexCompatibilityVersion())) continue; // we can only support one major version backward
|
||||||
if (v.equals(Version.CURRENT)) continue; // the current version is always compatible with itself
|
if (v.equals(Version.CURRENT)) continue; // the current version is always compatible with itself
|
||||||
if (v.isBeta() == true || v.isAlpha() == true || v.isRC() == true) continue; // don't check alphas etc
|
if (v.isBeta() == true || v.isAlpha() == true || v.isRC() == true) continue; // don't check alphas etc
|
||||||
expectedVersions.add("x-pack-" + v.toString() + ".zip");
|
expectedVersions.add("x-pack-" + v.toString() + ".zip");
|
||||||
|
|
|
@ -87,7 +87,6 @@ public class OldSecurityIndexBackwardsCompatibilityTests extends AbstractOldXPac
|
||||||
assertThat(builder.string(),
|
assertThat(builder.string(),
|
||||||
anyOf(containsString("\"roles\":{\"native\":{\"size\":1,\"fls\":true,\"dls\":true}"),
|
anyOf(containsString("\"roles\":{\"native\":{\"size\":1,\"fls\":true,\"dls\":true}"),
|
||||||
containsString("\"roles\":{\"native\":{\"size\":1,\"dls\":true,\"fls\":true}")));
|
containsString("\"roles\":{\"native\":{\"size\":1,\"dls\":true,\"fls\":true}")));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +127,7 @@ public class OldSecurityIndexBackwardsCompatibilityTests extends AbstractOldXPac
|
||||||
|
|
||||||
/* check that a search that misses all documents doesn't hit any alias starting with `-`. We have one in the backwards compatibility
|
/* check that a search that misses all documents doesn't hit any alias starting with `-`. We have one in the backwards compatibility
|
||||||
* indices for versions before 5.1.0 because we can't create them any more. */
|
* indices for versions before 5.1.0 because we can't create them any more. */
|
||||||
if (version.before(Version.V_5_1_1_UNRELEASED)) {
|
if (version.before(Version.V_5_1_1)) {
|
||||||
GetAliasesResponse aliasesResponse = client().admin().indices().prepareGetAliases().get();
|
GetAliasesResponse aliasesResponse = client().admin().indices().prepareGetAliases().get();
|
||||||
List<AliasMetaData> aliases = aliasesResponse.getAliases().get("index3");
|
List<AliasMetaData> aliases = aliasesResponse.getAliases().get("index3");
|
||||||
assertThat("alias doesn't exist", aliases, hasSize(1));
|
assertThat("alias doesn't exist", aliases, hasSize(1));
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class JobStateTests extends ESTestCase {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void testStreaming_v54BackwardsCompatibility() throws IOException {
|
public void testStreaming_v54BackwardsCompatibility() throws IOException {
|
||||||
StreamOutput out = mock(StreamOutput.class);
|
StreamOutput out = mock(StreamOutput.class);
|
||||||
when(out.getVersion()).thenReturn(Version.V_5_4_0_UNRELEASED);
|
when(out.getVersion()).thenReturn(Version.V_5_4_0);
|
||||||
ArgumentCaptor<Enum> enumCaptor = ArgumentCaptor.forClass(Enum.class);
|
ArgumentCaptor<Enum> enumCaptor = ArgumentCaptor.forClass(Enum.class);
|
||||||
|
|
||||||
doAnswer(new Answer<Void>() {
|
doAnswer(new Answer<Void>() {
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class MonitoringBulkDocTests extends ESTestCase {
|
||||||
public void testSerializationBwc() throws IOException {
|
public void testSerializationBwc() throws IOException {
|
||||||
final byte[] data = Base64.getDecoder().decode("AQNtSWQBBTUuMS4yAAAAAQEEdHlwZQECaWQNeyJmb28iOiJiYXIifQAAAAAAAAAA");
|
final byte[] data = Base64.getDecoder().decode("AQNtSWQBBTUuMS4yAAAAAQEEdHlwZQECaWQNeyJmb28iOiJiYXIifQAAAAAAAAAA");
|
||||||
final Version version = randomFrom(Version.V_5_0_0, Version.V_5_0_1, Version.V_5_0_2,
|
final Version version = randomFrom(Version.V_5_0_0, Version.V_5_0_1, Version.V_5_0_2,
|
||||||
Version.V_5_0_3_UNRELEASED, Version.V_5_1_1_UNRELEASED, Version.V_5_1_2_UNRELEASED, Version.V_5_2_0_UNRELEASED);
|
Version.V_5_1_1, Version.V_5_1_2, Version.V_5_2_0);
|
||||||
try (StreamInput in = StreamInput.wrap(data)) {
|
try (StreamInput in = StreamInput.wrap(data)) {
|
||||||
in.setVersion(version);
|
in.setVersion(version);
|
||||||
MonitoringBulkDoc bulkDoc = MonitoringBulkDoc.readFrom(in);
|
MonitoringBulkDoc bulkDoc = MonitoringBulkDoc.readFrom(in);
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class MonitoringDocTests extends ESTestCase {
|
||||||
|
|
||||||
String nodeId = randomAlphaOfLength(5);
|
String nodeId = randomAlphaOfLength(5);
|
||||||
TransportAddress address = buildNewFakeTransportAddress();
|
TransportAddress address = buildNewFakeTransportAddress();
|
||||||
Version version = randomFrom(Version.V_5_0_1, Version.V_5_3_0_UNRELEASED, Version.CURRENT);
|
Version version = randomFrom(Version.V_5_0_1, Version.V_5_3_0, Version.CURRENT);
|
||||||
|
|
||||||
String name = randomBoolean() ? randomAlphaOfLength(5) : "";
|
String name = randomBoolean() ? randomAlphaOfLength(5) : "";
|
||||||
Map<String, String> attributes = new HashMap<>();
|
Map<String, String> attributes = new HashMap<>();
|
||||||
|
|
|
@ -167,7 +167,7 @@ public class NativeRealmMigratorTests extends ESTestCase {
|
||||||
.immutableMap()
|
.immutableMap()
|
||||||
);
|
);
|
||||||
String[] disabledUsers = new String[]{LogstashSystemUser.NAME, BeatsSystemUser.NAME};
|
String[] disabledUsers = new String[]{LogstashSystemUser.NAME, BeatsSystemUser.NAME};
|
||||||
verifyUpgrade(randomFrom(Version.V_5_1_1_UNRELEASED, Version.V_5_0_2, Version.V_5_0_0), disabledUsers, true);
|
verifyUpgrade(randomFrom(Version.V_5_1_1, Version.V_5_0_2, Version.V_5_0_0), disabledUsers, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDisableBeatsAndConvertPasswordsOnUpgradeFromVersionPriorToV6() throws Exception {
|
public void testDisableBeatsAndConvertPasswordsOnUpgradeFromVersionPriorToV6() throws Exception {
|
||||||
|
@ -179,7 +179,7 @@ public class NativeRealmMigratorTests extends ESTestCase {
|
||||||
.immutableMap()
|
.immutableMap()
|
||||||
);
|
);
|
||||||
String[] disabledUsers = new String[]{BeatsSystemUser.NAME};
|
String[] disabledUsers = new String[]{BeatsSystemUser.NAME};
|
||||||
Version version = randomFrom(Version.V_5_3_0_UNRELEASED, Version.V_5_2_1_UNRELEASED);
|
Version version = randomFrom(Version.V_5_3_0, Version.V_5_2_1);
|
||||||
verifyUpgrade(version, disabledUsers, true);
|
verifyUpgrade(version, disabledUsers, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@ public class NativeRealmMigratorTests extends ESTestCase {
|
||||||
.immutableMap()
|
.immutableMap()
|
||||||
));
|
));
|
||||||
String[] disabledUsers = new String[]{BeatsSystemUser.NAME};
|
String[] disabledUsers = new String[]{BeatsSystemUser.NAME};
|
||||||
verifyUpgrade(Version.V_5_2_0_UNRELEASED, disabledUsers, true);
|
verifyUpgrade(Version.V_5_2_0, disabledUsers, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void verifyUpgrade(Version fromVersion, String[] disabledUsers, boolean convertDefaultPasswords) throws Exception {
|
private void verifyUpgrade(Version fromVersion, String[] disabledUsers, boolean convertDefaultPasswords) throws Exception {
|
||||||
|
|
|
@ -360,13 +360,13 @@ public class ReservedRealmTests extends ESTestCase {
|
||||||
switch (principal) {
|
switch (principal) {
|
||||||
case LogstashSystemUser.NAME:
|
case LogstashSystemUser.NAME:
|
||||||
assertThat(versionPredicate.test(Version.V_5_0_0), is(false));
|
assertThat(versionPredicate.test(Version.V_5_0_0), is(false));
|
||||||
assertThat(versionPredicate.test(Version.V_5_1_1_UNRELEASED), is(false));
|
assertThat(versionPredicate.test(Version.V_5_1_1), is(false));
|
||||||
assertThat(versionPredicate.test(Version.V_5_2_0_UNRELEASED), is(true));
|
assertThat(versionPredicate.test(Version.V_5_2_0), is(true));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assertThat(versionPredicate.test(Version.V_5_0_0), is(true));
|
assertThat(versionPredicate.test(Version.V_5_0_0), is(true));
|
||||||
assertThat(versionPredicate.test(Version.V_5_1_1_UNRELEASED), is(true));
|
assertThat(versionPredicate.test(Version.V_5_1_1), is(true));
|
||||||
assertThat(versionPredicate.test(Version.V_5_2_0_UNRELEASED), is(true));
|
assertThat(versionPredicate.test(Version.V_5_2_0), is(true));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
assertThat(versionPredicate.test(Version.V_6_0_0_alpha1_UNRELEASED), is(true));
|
assertThat(versionPredicate.test(Version.V_6_0_0_alpha1_UNRELEASED), is(true));
|
||||||
|
|
|
@ -31,7 +31,6 @@ import org.elasticsearch.cluster.metadata.IndexMetaData;
|
||||||
import org.elasticsearch.cluster.metadata.IndexTemplateMetaData;
|
import org.elasticsearch.cluster.metadata.IndexTemplateMetaData;
|
||||||
import org.elasticsearch.cluster.metadata.MetaData;
|
import org.elasticsearch.cluster.metadata.MetaData;
|
||||||
import org.elasticsearch.cluster.node.DiscoveryNodes;
|
import org.elasticsearch.cluster.node.DiscoveryNodes;
|
||||||
import org.elasticsearch.common.collect.Tuple;
|
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.util.concurrent.ThreadContext;
|
import org.elasticsearch.common.util.concurrent.ThreadContext;
|
||||||
import org.elasticsearch.common.xcontent.XContentType;
|
import org.elasticsearch.common.xcontent.XContentType;
|
||||||
|
@ -183,7 +182,7 @@ public class IndexLifecycleManagerTests extends ESTestCase {
|
||||||
assertThat(manager.isTemplateCreationPending(), Matchers.equalTo(templateUpdatePending));
|
assertThat(manager.isTemplateCreationPending(), Matchers.equalTo(templateUpdatePending));
|
||||||
|
|
||||||
assertThat(manager.isMappingUpToDate(), Matchers.equalTo(false));
|
assertThat(manager.isMappingUpToDate(), Matchers.equalTo(false));
|
||||||
assertThat(manager.getMappingVersion(), Matchers.equalTo(Version.V_5_1_2_UNRELEASED));
|
assertThat(manager.getMappingVersion(), Matchers.equalTo(Version.V_5_1_2));
|
||||||
assertThat(manager.isMappingUpdatePending(), Matchers.equalTo(mappingUpdatePending));
|
assertThat(manager.isMappingUpdatePending(), Matchers.equalTo(mappingUpdatePending));
|
||||||
|
|
||||||
assertThat(manager.isWritable(), Matchers.equalTo(false));
|
assertThat(manager.isWritable(), Matchers.equalTo(false));
|
||||||
|
|
|
@ -211,7 +211,7 @@ public class SecurityServerTransportInterceptorTests extends ESTestCase {
|
||||||
};
|
};
|
||||||
AsyncSender sender = interceptor.interceptSender(intercepted);
|
AsyncSender sender = interceptor.interceptSender(intercepted);
|
||||||
Transport.Connection connection = mock(Transport.Connection.class);
|
Transport.Connection connection = mock(Transport.Connection.class);
|
||||||
final Version version = Version.fromId(randomIntBetween(Version.V_5_0_0_ID, Version.V_5_2_0_ID_UNRELEASED - 100));
|
final Version version = Version.fromId(randomIntBetween(Version.V_5_0_0_ID, Version.V_5_2_0_ID - 100));
|
||||||
when(connection.getVersion()).thenReturn(version);
|
when(connection.getVersion()).thenReturn(version);
|
||||||
sender.sendRequest(connection, "indices:foo[s]", null, null, null);
|
sender.sendRequest(connection, "indices:foo[s]", null, null, null);
|
||||||
assertTrue(calledWrappedSender.get());
|
assertTrue(calledWrappedSender.get());
|
||||||
|
@ -223,7 +223,7 @@ public class SecurityServerTransportInterceptorTests extends ESTestCase {
|
||||||
// reset and test with version that was changed
|
// reset and test with version that was changed
|
||||||
calledWrappedSender.set(false);
|
calledWrappedSender.set(false);
|
||||||
sendingUser.set(null);
|
sendingUser.set(null);
|
||||||
when(connection.getVersion()).thenReturn(Version.V_5_2_0_UNRELEASED);
|
when(connection.getVersion()).thenReturn(Version.V_5_2_0);
|
||||||
sender.sendRequest(connection, "indices:foo[s]", null, null, null);
|
sender.sendRequest(connection, "indices:foo[s]", null, null, null);
|
||||||
assertTrue(calledWrappedSender.get());
|
assertTrue(calledWrappedSender.get());
|
||||||
assertEquals(user, sendingUser.get());
|
assertEquals(user, sendingUser.get());
|
||||||
|
|
|
@ -223,7 +223,7 @@ public class ServerTransportFilterTests extends ESTestCase {
|
||||||
TransportRequest request = mock(TransportRequest.class);
|
TransportRequest request = mock(TransportRequest.class);
|
||||||
User user = new User("kibana", "kibana");
|
User user = new User("kibana", "kibana");
|
||||||
Authentication authentication = mock(Authentication.class);
|
Authentication authentication = mock(Authentication.class);
|
||||||
final Version version = Version.fromId(randomIntBetween(Version.V_5_0_0_ID, Version.V_5_2_0_ID_UNRELEASED - 100));
|
final Version version = Version.fromId(randomIntBetween(Version.V_5_0_0_ID, Version.V_5_2_0_ID - 100));
|
||||||
when(authentication.getVersion()).thenReturn(version);
|
when(authentication.getVersion()).thenReturn(version);
|
||||||
when(authentication.getUser()).thenReturn(user);
|
when(authentication.getUser()).thenReturn(user);
|
||||||
doAnswer((i) -> {
|
doAnswer((i) -> {
|
||||||
|
@ -253,7 +253,7 @@ public class ServerTransportFilterTests extends ESTestCase {
|
||||||
rolesRef.set(null);
|
rolesRef.set(null);
|
||||||
user = new KibanaUser(true);
|
user = new KibanaUser(true);
|
||||||
when(authentication.getUser()).thenReturn(user);
|
when(authentication.getUser()).thenReturn(user);
|
||||||
when(authentication.getVersion()).thenReturn(Version.V_5_2_0_UNRELEASED);
|
when(authentication.getVersion()).thenReturn(Version.V_5_2_0);
|
||||||
future = new PlainActionFuture<>();
|
future = new PlainActionFuture<>();
|
||||||
filter.inbound("_action", request, channel, future);
|
filter.inbound("_action", request, channel, future);
|
||||||
assertNotNull(rolesRef.get());
|
assertNotNull(rolesRef.get());
|
||||||
|
|
|
@ -12,7 +12,6 @@ import org.elasticsearch.Version;
|
||||||
import org.elasticsearch.common.io.stream.BytesStreamOutput;
|
import org.elasticsearch.common.io.stream.BytesStreamOutput;
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.test.ESTestCase;
|
import org.elasticsearch.test.ESTestCase;
|
||||||
import org.elasticsearch.test.VersionUtils;
|
|
||||||
|
|
||||||
import static org.hamcrest.Matchers.is;
|
import static org.hamcrest.Matchers.is;
|
||||||
import static org.hamcrest.Matchers.not;
|
import static org.hamcrest.Matchers.not;
|
||||||
|
@ -66,7 +65,7 @@ public class UserTests extends ESTestCase {
|
||||||
BytesStreamOutput output = new BytesStreamOutput();
|
BytesStreamOutput output = new BytesStreamOutput();
|
||||||
User.writeTo(authUser, output);
|
User.writeTo(authUser, output);
|
||||||
StreamInput input = output.bytes().streamInput();
|
StreamInput input = output.bytes().streamInput();
|
||||||
input.setVersion(randomFrom(Version.V_5_0_0, Version.V_5_4_0_UNRELEASED));
|
input.setVersion(randomFrom(Version.V_5_0_0, Version.V_5_4_0));
|
||||||
User readFrom = User.readFrom(input);
|
User readFrom = User.readFrom(input);
|
||||||
|
|
||||||
assertThat(readFrom.principal(), is(user.principal()));
|
assertThat(readFrom.principal(), is(user.principal()));
|
||||||
|
@ -84,7 +83,7 @@ public class UserTests extends ESTestCase {
|
||||||
User authUser = new User(randomAlphaOfLengthBetween(4, 30), generateRandomStringArray(20, 30, false), user);
|
User authUser = new User(randomAlphaOfLengthBetween(4, 30), generateRandomStringArray(20, 30, false), user);
|
||||||
|
|
||||||
BytesStreamOutput output = new BytesStreamOutput();
|
BytesStreamOutput output = new BytesStreamOutput();
|
||||||
output.setVersion(randomFrom(Version.V_5_0_0, Version.V_5_4_0_UNRELEASED));
|
output.setVersion(randomFrom(Version.V_5_0_0, Version.V_5_4_0));
|
||||||
User.writeTo(authUser, output);
|
User.writeTo(authUser, output);
|
||||||
StreamInput input = output.bytes().streamInput();
|
StreamInput input = output.bytes().streamInput();
|
||||||
User readFrom = User.readFrom(input);
|
User readFrom = User.readFrom(input);
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class ExecuteWatchRequestTests extends ESTestCase {
|
||||||
public void testSerializationBwc() throws IOException {
|
public void testSerializationBwc() throws IOException {
|
||||||
final byte[] data = Base64.getDecoder().decode("ADwDAAAAAAAAAAAAAAAAAAABDnsid2F0Y2giOiJtZSJ9AAAAAAAAAA==");
|
final byte[] data = Base64.getDecoder().decode("ADwDAAAAAAAAAAAAAAAAAAABDnsid2F0Y2giOiJtZSJ9AAAAAAAAAA==");
|
||||||
final Version version = randomFrom(Version.V_5_0_0, Version.V_5_0_1, Version.V_5_0_2,
|
final Version version = randomFrom(Version.V_5_0_0, Version.V_5_0_1, Version.V_5_0_2,
|
||||||
Version.V_5_0_3_UNRELEASED, Version.V_5_1_1_UNRELEASED, Version.V_5_1_2_UNRELEASED, Version.V_5_2_0_UNRELEASED);
|
Version.V_5_1_1, Version.V_5_1_2, Version.V_5_2_0);
|
||||||
try (StreamInput in = StreamInput.wrap(data)) {
|
try (StreamInput in = StreamInput.wrap(data)) {
|
||||||
in.setVersion(version);
|
in.setVersion(version);
|
||||||
ExecuteWatchRequest request = new ExecuteWatchRequest();
|
ExecuteWatchRequest request = new ExecuteWatchRequest();
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class PutWatchSerializationTests extends ESTestCase {
|
||||||
public void testPutWatchSerializationXContentBwc() throws IOException {
|
public void testPutWatchSerializationXContentBwc() throws IOException {
|
||||||
final byte[] data = Base64.getDecoder().decode("ADwDAmlkDXsiZm9vIjoiYmFyIn0BAAAA");
|
final byte[] data = Base64.getDecoder().decode("ADwDAmlkDXsiZm9vIjoiYmFyIn0BAAAA");
|
||||||
final Version version = randomFrom(Version.V_5_0_0, Version.V_5_0_1, Version.V_5_0_2,
|
final Version version = randomFrom(Version.V_5_0_0, Version.V_5_0_1, Version.V_5_0_2,
|
||||||
Version.V_5_0_3_UNRELEASED, Version.V_5_1_1_UNRELEASED, Version.V_5_1_2_UNRELEASED, Version.V_5_2_0_UNRELEASED);
|
Version.V_5_1_1, Version.V_5_1_2, Version.V_5_2_0);
|
||||||
try (StreamInput in = StreamInput.wrap(data)) {
|
try (StreamInput in = StreamInput.wrap(data)) {
|
||||||
in.setVersion(version);
|
in.setVersion(version);
|
||||||
PutWatchRequest request = new PutWatchRequest();
|
PutWatchRequest request = new PutWatchRequest();
|
||||||
|
|
Loading…
Reference in New Issue