-
Notifications
You must be signed in to change notification settings - Fork 24.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[test] Introduce strict deprecation mode for REST tests #34338
Conversation
If a deprecation warning has been returned by the server, the REST tests fail.
Pinging @elastic/es-core-infra |
@lipsill, I'm travelling this week and won't be particularly responsive. I skimmed this so I can say, @elasticmachine, test this please. I've not thought through the implications of that template setting the number of shards. I promise all do that the next chance I get. |
@elasticmachine, test this please |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a few inline comments but I've realized a thing: could you pull the template creation into the AbstractXXTestCase
classes in its own @Before
method? That'd solve a bunch of these
@@ -153,4 +153,9 @@ protected Settings restClientSettings() { | |||
.put(ThreadContext.PREFIX + ".Authorization", token) | |||
.build(); | |||
} | |||
|
|||
@Override | |||
protected boolean getStrictDeprecationMode() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think we should turn this to true
now that I've merged #34338?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would love to! But in the mean time #34135 got merged and it added a deprecated setting:
setting 'xpack.security.transport.ssl.truststore.password', 'testnode' |
I think this is the reason for the two tests below to fail once the strict deprecation mode is on:
./gradlew :client:rest-high-level:integTestRunner -Dtests.seed=B82DCBDDD63664E9 -Dtests.class=org.elasticsearch.client.documentation.ClusterClientDocumentationIT -Dtests.method="testClusterGetSettings"
./gradlew :client:rest-high-level:integTestRunner -Dtests.seed=B82DCBDDD63664E9 -Dtests.class=org.elasticsearch.client.ClusterClientIT -Dtests.method="testClusterGetSettingsWithDefault"
[xpack.security.transport.ssl.truststore.password] setting was deprecated in Elasticsearch and will be removed in a future release! See the breaking changes documentation for the next major version.
I did not see what setting to use instead of xpack.security.transport.ssl.truststore.password
. TBH I am not really sure if the setting should be deprecated in the first place as I did not find it mentioned in any docs...
@nik9000 do you have any ideas / pointers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it is deprecated
Lines 92 to 95 in 46c7b5e
private static final Function<String, Setting<SecureString>> LEGACY_TRUSTSTORE_PASSWORD_TEMPLATE = key -> | |
new Setting<>(key, "", SecureString::new, Property.Deprecated, Property.Filtered, Property.NodeScope); | |
public static final Setting<SecureString> LEGACY_TRUSTSTORE_PASSWORD_PROFILES = Setting.affixKeySetting("transport.profiles.", | |
"xpack.security.ssl.truststore.password", LEGACY_TRUSTSTORE_PASSWORD_TEMPLATE); |
and I shouldn't have used it. I'll raise a follow-up PR tomorrow my morning to address this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -283,7 +300,8 @@ public void testClusterState() throws Exception { | |||
if (isRunningAgainstOldCluster()) { | |||
XContentBuilder mappingsAndSettings = jsonBuilder(); | |||
mappingsAndSettings.startObject(); | |||
mappingsAndSettings.field("template", index); | |||
mappingsAndSettings.field("index_patterns", index); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
index = getTestName().toLowerCase(Locale.ROOT); | ||
// TODO prevents 6.x warnings; remove in 8.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two things here:
- Could you add something like
assertThat("we don't need this branch if we aren't compatible with 6.0", Version.CURRENT.minimumIndexCompatibilityVersion(), lessThanOrEqualTo(Version.6.0.0));
- Could you check if
getOldClusterVersion()
is less than 7 before doing this? It won't matter right now, but once we release 7.0 it'll show up as an "old" version and we don't want this template.
client().performRequest(clearRoutingFromSettings); | ||
try { | ||
Request clearRoutingFromSettings = new Request("PUT", "/_cluster/settings"); | ||
clearRoutingFromSettings.setJsonEntity("{\"persistent\":{\"cluster.routing.allocation.exclude.test_attr\": null}}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh. So it warns you whenever you update settings if any setting is deprecated? So sometimes this'll fail and sometimes it won't based on the test run order. Fun.
@@ -60,6 +64,20 @@ public void testIndexing() throws IOException { | |||
} | |||
|
|||
if (CLUSTER_TYPE == ClusterType.OLD) { | |||
// TODO prevents 6.x warnings; remove in 8.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same note as above.
@@ -59,6 +62,22 @@ | |||
@Before | |||
public void waitForMlTemplates() throws Exception { | |||
XPackRestTestHelper.waitForMlTemplates(client()); | |||
// TODO prevents 6.x warnings; remove in 8.0 | |||
if (isRunningAgainstOldCluster()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same note as above about the checking if the version is in range and asserting the index compatible version.
@@ -45,6 +49,21 @@ public void testIndexing() throws IOException { | |||
} | |||
|
|||
if (CLUSTER_TYPE == ClusterType.OLD) { | |||
// TODO prevents 6.x warnings; remove in 8.0 | |||
XContentBuilder template = jsonBuilder(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as above.
public class TokenBackwardsCompatibilityIT extends AbstractUpgradeTestCase { | ||
|
||
public void testGeneratingTokenInOldCluster() throws Exception { | ||
assumeTrue("this test should only run against the old cluster", CLUSTER_TYPE == ClusterType.OLD); | ||
|
||
XContentBuilder template = jsonBuilder(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as above.
@nik9000 btw how comes that a build is automatically started? |
@nik9000 can you trigger another CI? |
@elasticmachine, test this please. |
I didn't see, did one start without one of us saying the magic words? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good to me! Let's see what CI thinks.....
I think so ;) After pushing 4 commits, the CI started : |
That failure doesn't look related. Let me see if I can reproduce that one on my own.... @elsticmachine, retest this please |
OK! I've merged to master and started the backport to 6.x. Thanks for working on this @lipsill! |
I think I'm going to abandon backporting this. 6.x logs a ton of warnings because of the default number of shards change. Instead of just being in the BWC tests it is everywhere. We work around it in the yaml tests but we don't have a similar workaround for all of the REST tests. So this'll stay in master only. I think that is fairly safe. |
The pull request elastic#34338 added strict deprecation mode to the REST tests and adds the copy_settings param when testing the shrink of an index. This parameter has been added in 6.4.0 and will be removed in 8.0, so the test now needs to take care of the old cluster version when adding the copy_settings param.
Ops... I guess the simplest approach would be to create a template with 5 shards in +1 for merging only in Another option will be to merge the fixes but activate the strict mode only for the docs in @nik9000 what do you think? |
…#34853) The pull request #34338 added strict deprecation mode to the REST tests and adds the copy_settings param when testing the shrink of an index. This parameter has been added in 6.4.0 and will be removed in 8.0, so the test now needs to take care of the old cluster version when adding the copy_settings param.
I like this option quite a bit! I had just merged this to master and couldn't get the strict mode passing without a lot of changes. 6.x is under active development, but 99% of the time patches land in master first and we backport so having strict mode in 6.x is a lot less important. Would you like to open a PR against 6.x that backports just the fixes without the strict mode? If not I'll add it to my list. |
@nik9000 I can take this one over ;) |
#33708 introduced a strict deprecation mode that makes a REST request fail if there is a warning header in the response returned by Elasticsearch (usually a deprecation message signaling that a feature or a field has been deprecated). This change adds the strict deprecation mode into the REST integration tests, and makes the tests fail if a deprecated feature is used. Also any test using a deprecated feature has been modified to pass the build. The YAML integration tests already analyzed HTTP warnings so they do not use this mode, keeping their "expected vs actual" behavior.
…#34853) The pull request #34338 added strict deprecation mode to the REST tests and adds the copy_settings param when testing the shrink of an index. This parameter has been added in 6.4.0 and will be removed in 8.0, so the test now needs to take care of the old cluster version when adding the copy_settings param.
#33708 introduced a strict deprecation mode that makes a REST request fail if there is a warning header in the response returned by Elasticsearch (usually a deprecation message signaling that a feature or a field has been deprecated).
This change adds the strict deprecation mode into the REST integration tests, and makes the tests fail if a deprecated feature is used. Also any test using a deprecated feature has been modified to pass the build.
There are two notable exceptions: