test: initialize cluster term and correct HTTP/2 timeout for watch tests #7969
+7
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Ⅰ. Describe what this PR did
This change adds initial cluster state setup by publishing a
ClusterChangeEventwith term=1 at the start of bothwatch()andwatch_withHttp2()tests. It also corrects the HTTP/2 timeout inwatch_withHttp2()from 30ms to 30000ms. Before the change, the tests passed in some cases and failed on the others. They passed in sequential builds becausewatch()would set the server's static state to term=2, causingwatch_withHttp2()to receive an immediate response when it requested term=1, making the 30ms timeout look sufficient. In parallel builds or isolated execution, the tests failed (sometimes) because without the cached state, the server would wait for the 2-second delayed event, exceeding the 30ms timeout. By resetting the state to term=1 before each test, both tests now start with an initial baseline and properly validate the long-polling behavior without giving false positives.Ⅱ. Does this pull request fix one issue?
fixes #7963
Ⅲ. Why don't you add test cases (unit test/integration test)?
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews
I’m new here, please let me know if anything in this PR should be done differently