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

RATIS-2219. Remove duplicate test case from TestRaftWithGrpc #1192

Merged
merged 2 commits into from
Dec 23, 2024

Conversation

adoroszlai
Copy link
Contributor

@adoroszlai adoroszlai commented Dec 21, 2024

What changes were proposed in this pull request?

TestRaftWithGrpc#testWithLoad is run 3 times, twice with the same value for raft.grpc.server.heartbeat.channel. This happens because testWithLoad(boolean) no longer overrides testWithLoad from parent class after RATIS-1976.

$ mvn -am -pl :ratis-test clean test -Dtest='TestRaftWithGrpc' -Dsurefire.reportFormat=plain
...
Tests run: 12, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 174.463 s - in org.apache.ratis.grpc.TestRaftWithGrpc
org.apache.ratis.grpc.TestRaftWithGrpc.testStateMachineMetrics  Time elapsed: 3.415 s
org.apache.ratis.grpc.TestRaftWithGrpc.testBasicAppendEntries  Time elapsed: 12.339 s
org.apache.ratis.grpc.TestRaftWithGrpc.testBasicAppendEntriesKillLeader  Time elapsed: 11.075 s
org.apache.ratis.grpc.TestRaftWithGrpc.testOldLeaderCommit  Time elapsed: 5.489 s
org.apache.ratis.grpc.TestRaftWithGrpc.testWithLoad  Time elapsed: 39.118 s
org.apache.ratis.grpc.TestRaftWithGrpc.testOldLeaderNotCommit  Time elapsed: 5.974 s
org.apache.ratis.grpc.TestRaftWithGrpc.testWithLoad(Boolean)[1]  Time elapsed: 35.295 s
org.apache.ratis.grpc.TestRaftWithGrpc.testWithLoad(Boolean)[2]  Time elapsed: 31.996 s
org.apache.ratis.grpc.TestRaftWithGrpc.testRequestTimeout(Boolean)[1]  Time elapsed: 8.094 s
org.apache.ratis.grpc.TestRaftWithGrpc.testRequestTimeout(Boolean)[2]  Time elapsed: 8.178 s
org.apache.ratis.grpc.TestRaftWithGrpc.testUpdateViaHeartbeat(Boolean)[1]  Time elapsed: 6.718 s
org.apache.ratis.grpc.TestRaftWithGrpc.testUpdateViaHeartbeat(Boolean)[2]  Time elapsed: 6.675 s

Also, simplify parameterized test cases (use boolean instead of Boolean).

https://issues.apache.org/jira/browse/RATIS-2219

How was this patch tested?

$ mvn -am -pl :ratis-test clean test -Dtest='TestRaftWithGrpc' -Dsurefire.reportFormat=plain
...
[INFO] Tests run: 11, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 136.215 s - in org.apache.ratis.grpc.TestRaftWithGrpc
[INFO] org.apache.ratis.grpc.TestRaftWithGrpc.testStateMachineMetrics  Time elapsed: 2.96 s
[INFO] org.apache.ratis.grpc.TestRaftWithGrpc.testBasicAppendEntries  Time elapsed: 11.725 s
[INFO] org.apache.ratis.grpc.TestRaftWithGrpc.testBasicAppendEntriesKillLeader  Time elapsed: 11.64 s
[INFO] org.apache.ratis.grpc.TestRaftWithGrpc.testOldLeaderCommit  Time elapsed: 5.784 s
[INFO] org.apache.ratis.grpc.TestRaftWithGrpc.testOldLeaderNotCommit  Time elapsed: 5.727 s
[INFO] org.apache.ratis.grpc.TestRaftWithGrpc.testWithLoad(boolean)[1]  Time elapsed: 35.745 s
[INFO] org.apache.ratis.grpc.TestRaftWithGrpc.testWithLoad(boolean)[2]  Time elapsed: 32.84 s
[INFO] org.apache.ratis.grpc.TestRaftWithGrpc.testRequestTimeout(boolean)[1]  Time elapsed: 8.183 s
[INFO] org.apache.ratis.grpc.TestRaftWithGrpc.testRequestTimeout(boolean)[2]  Time elapsed: 8.181 s
[INFO] org.apache.ratis.grpc.TestRaftWithGrpc.testUpdateViaHeartbeat(boolean)[1]  Time elapsed: 6.683 s
[INFO] org.apache.ratis.grpc.TestRaftWithGrpc.testUpdateViaHeartbeat(boolean)[2]  Time elapsed: 6.658 s

@adoroszlai adoroszlai self-assigned this Dec 21, 2024
@adoroszlai adoroszlai changed the title RATIS-2219. Reduce TestRaftWithGrpc run time RATIS-2219. Remove duplicate test case from TestRaftWithGrpc Dec 21, 2024
@adoroszlai
Copy link
Contributor Author

On a related note, currently only the 3 methods defined in TestRaftWithGrpc are parameterized for the config raft.grpc.server.heartbeat.channel. Is this setting relevant for the test cases inherited from parent class?

[INFO] org.apache.ratis.grpc.TestRaftWithGrpc.testStateMachineMetrics  Time elapsed: 2.96 s
[INFO] org.apache.ratis.grpc.TestRaftWithGrpc.testBasicAppendEntries  Time elapsed: 11.725 s
[INFO] org.apache.ratis.grpc.TestRaftWithGrpc.testBasicAppendEntriesKillLeader  Time elapsed: 11.64 s
[INFO] org.apache.ratis.grpc.TestRaftWithGrpc.testOldLeaderCommit  Time elapsed: 5.784 s
[INFO] org.apache.ratis.grpc.TestRaftWithGrpc.testOldLeaderNotCommit  Time elapsed: 5.727 s

Should we also parameterize these?

Copy link
Contributor

@szetszwo szetszwo left a comment

Choose a reason for hiding this comment

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

+1 the change looks good.

TestLeaderInstallSnapshotWithGrpc also has a similar problem. Would you like to fix it here?

@szetszwo
Copy link
Contributor

On a related note, currently only the 3 methods defined in TestRaftWithGrpc are parameterized for the config raft.grpc.server.heartbeat.channel. Is this setting relevant for the test cases inherited from parent class?

It seems okay to skip those test cases. We should identify test cases for running with parameterized config. testWithLoad and testUpdateViaHeartbeat are good candidates.

@adoroszlai
Copy link
Contributor Author

TestLeaderInstallSnapshotWithGrpc does not seem to have the same problem. The test methods in parent class InstallSnapshotFromLeaderTests are not annotated with @Test, so they are not executed in themselves, only when called from the parameterized test methods in the child class.

[INFO] Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 17.515 s - in org.apache.ratis.grpc.TestLeaderInstallSnapshotWithGrpc
[INFO] org.apache.ratis.grpc.TestLeaderInstallSnapshotWithGrpc.testMultiFileInstallSnapshot(Boolean)[1]  Time elapsed: 3.553 s
[INFO] org.apache.ratis.grpc.TestLeaderInstallSnapshotWithGrpc.testMultiFileInstallSnapshot(Boolean)[2]  Time elapsed: 2.1 s
[INFO] org.apache.ratis.grpc.TestLeaderInstallSnapshotWithGrpc.testInstallSnapshotLeaderSwitch(Boolean)[1]  Time elapsed: 3.148 s
[INFO] org.apache.ratis.grpc.TestLeaderInstallSnapshotWithGrpc.testInstallSnapshotLeaderSwitch(Boolean)[2]  Time elapsed: 4.915 s
[INFO] org.apache.ratis.grpc.TestLeaderInstallSnapshotWithGrpc.testSeparateSnapshotInstallPath(Boolean)[1]  Time elapsed: 1.857 s
[INFO] org.apache.ratis.grpc.TestLeaderInstallSnapshotWithGrpc.testSeparateSnapshotInstallPath(Boolean)[2]  Time elapsed: 1.839 s

@szetszwo szetszwo merged commit de2fec6 into apache:master Dec 23, 2024
12 checks passed
@adoroszlai adoroszlai deleted the RATIS-2219 branch December 23, 2024 19:17
@adoroszlai
Copy link
Contributor Author

Thanks @szetszwo for reviewing and merging this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants