Skip to content
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] Add back necessary tests for deprecated settings that are replaced during applying inclusive naming #2825

Merged

Conversation

tlfeng
Copy link
Collaborator

@tlfeng tlfeng commented Apr 11, 2022

Description

Add some unit tests for validating the backwards compatibility of deprecated master node role and cluster.initial_master_nodes setting.
All the added tests are modified copies of existing tests.
The old node role/setting name in tests were replaced by new node role/setting name in PR #2424 and #2451, and in this PR I added some duplicate tests for the deprecated node role/setting name.

Reason:
To avoid the backwards compatibility of the deprecated setting is broken by mistake during the process of replacing non-inclusive terminology.
There was an issue #2769 that shown a fault caused by PR #2463 (Deprecate setting 'cluster.initial_master_nodes' and introduce the alternative setting 'cluster.initial_cluster_manager_nodes' ).

Issues Resolved

Resolve #2805

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@tlfeng tlfeng added :test Adding or fixing a test v2.0.0 Version 2.0.0 v2.1.0 Issues and PRs related to version 2.1.0 backport 2.x Backport to 2.x branch backport 2.0 Backport to 2.0 branch labels Apr 11, 2022
)
);
}

Copy link
Collaborator Author

@tlfeng tlfeng Apr 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: These 2 tests in this class (ClusterBootstrapServiceTests) are moved to the new class ClusterBootstrapServiceDeprecatedMasterTests

@opensearch-ci-bot
Copy link
Collaborator

❌   Gradle Check failure c64878f
Log 4321

Reports 4321

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Check success 76a20eb
Log 4322

Reports 4322

@tlfeng tlfeng marked this pull request as ready for review April 11, 2022 17:34
@tlfeng tlfeng requested a review from a team as a code owner April 11, 2022 17:34
@dblock dblock requested a review from kartg April 11, 2022 18:55
@tlfeng
Copy link
Collaborator Author

tlfeng commented Apr 11, 2022

I'm not sure if it's necessary to backport to 2.0 branch, because there is no fault found during adding the tests.
Probably backporting to 2.x branch is enough.

@tlfeng tlfeng removed v2.0.0 Version 2.0.0 backport 2.0 Backport to 2.0 branch labels Apr 11, 2022
@@ -144,6 +145,28 @@ public void testNodeCounts() {
}
}

// Validate assigning value "master" to setting "node.roles" can get correct count in Node Stats response after MASTER_ROLE deprecated.
// TODO: Remove the test after removing MASTER_ROLE.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick - I don't think we need these TODOs alongside all of the tests. When we remove DiscoveryNodeRole.MASTER_ROLE these tests would automatically break, so we would anyway resolve them then

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @kartg Thanks for your review! 👍 I will remove the unnecessary TODOs.
The reason I added them is to giving a clear mind that it definitely can be removed. 😂

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed all the TODO in this PR, and I believe the comment of every newly added test is enough to make people understand they are only used to test the deprecated "master" role setting.

.build();

assertThat(makeRequestWithNodeDescriptions("_local").resolveVotingConfigExclusions(clusterState), contains(localNodeExclusion));
assertWarnings(AddVotingConfigExclusionsRequest.DEPRECATION_MESSAGE);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assertion seems unnecessary for this test case - you can probably remove it

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏 You are so careful that notice such detail! Good catch, I will try to replace with exceptWarnings(), removing is not feasible, because any warnings can fail the test.

dblock
dblock previously requested changes Apr 21, 2022
Copy link
Member

@dblock dblock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tlfeng let us know when this is ready

@tlfeng tlfeng requested a review from reta as a code owner April 26, 2022 21:23
@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Check success 5722253
Log 4816

Reports 4816

@tlfeng
Copy link
Collaborator Author

tlfeng commented Apr 26, 2022

@kartg and @dblock , thank you for your review! I have resolved the above comments, could you please have a look at again?

@tlfeng tlfeng dismissed dblock’s stale review May 17, 2022 17:37

Resolved all above comments.

@tlfeng tlfeng merged commit 00c0bf2 into opensearch-project:main May 17, 2022
opensearch-trigger-bot bot pushed a commit that referenced this pull request May 17, 2022
…aced during applying inclusive naming (#2825)

Signed-off-by: Tianli Feng <[email protected]>
(cherry picked from commit 00c0bf2)
tlfeng pushed a commit that referenced this pull request May 17, 2022
…aced during applying inclusive naming (#2825) (#3353)

Signed-off-by: Tianli Feng <[email protected]>
(cherry picked from commit 00c0bf2)
@tlfeng
Copy link
Collaborator Author

tlfeng commented May 25, 2022

There is a test failure in log 4816:

> Task :server:test

REPRODUCE WITH: ./gradlew ':server:test' --tests "org.opensearch.cluster.node.DiscoveryNodeTests.testSetAdditionalRolesCanAddDeprecatedMasterRole" -Dtests.seed=ABC0D0B450403D5F -Dtests.security.manager=true -Dtests.jvm.argline="-XX:TieredStopAtLevel=1 -XX:ReservedCodeCacheSize=64m" -Dtests.locale=und -Dtests.timezone=Asia/Ujung_Pandang -Druntime.java=17

org.opensearch.cluster.node.DiscoveryNodeTests > testSetAdditionalRolesCanAddDeprecatedMasterRole FAILED
    java.lang.AssertionError
        at __randomizedtesting.SeedInfo.seed([ABC0D0B450403D5F:BC544B5D2E9D0B2A]:0)
        at org.junit.Assert.fail(Assert.java:87)
        at org.junit.Assert.assertTrue(Assert.java:42)
        at org.junit.Assert.assertFalse(Assert.java:65)
        at org.junit.Assert.assertFalse(Assert.java:75)
        at org.opensearch.cluster.node.DiscoveryNodeTests.testSetAdditionalRolesCanAddDeprecatedMasterRole(DiscoveryNodeTests.java:183)

The assertion failed:

assertFalse(DiscoveryNode.getPossibleRoleNames().contains(DiscoveryNodeRole.MASTER_ROLE.roleName()));

I will resolve the issue in PR #3441

@tlfeng tlfeng deleted the add-test-master-role-deprecation branch June 6, 2022 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x Backport to 2.x branch :test Adding or fixing a test v2.1.0 Issues and PRs related to version 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add back necessary tests for deprecated settings that are replaced during applying inclusive naming
4 participants