rich7420 commented on code in PR #11341:
URL: https://github.com/apache/ozone/pull/11341#discussion_r4128940969
##########
hadoop-ozone/integration-test-recon/src/test/java/org/apache/hadoop/ozone/recon/TestReconAsPassiveScm.java:
##########
@@ -91,15 +89,22 @@ public void testDatanodeRegistrationAndReports() throws
Exception {
PipelineManager reconPipelineManager = reconScm.getPipelineManager();
PipelineManager scmPipelineManager = scm.getPipelineManager();
- LambdaTestUtils.await(60000, 5000,
- () -> (reconPipelineManager.getPipelines().size() >= 4));
-
- // Verify if Recon has all the pipelines from SCM.
- scmPipelineManager.getPipelines().forEach(p -> {
+ // SCM and Recon update their pipeline state asynchronously. Validate the
+ // complete SCM snapshot inside the retry loop so a pipeline created after
+ // Recon reaches the expected count does not cause a one-shot failure.
+ LambdaTestUtils.await(60000, 5000, () -> {
+ if (scmPipelineManager.getPipelines().size() < 4) {
+ return false;
+ }
try {
- assertNotNull(reconPipelineManager.getPipeline(p.getId()));
+ for (Pipeline pipeline : scmPipelineManager.getPipelines()) {
+ if (reconPipelineManager.getPipeline(pipeline.getId()) == null) {
+ return false;
+ }
+ }
+ return true;
} catch (PipelineNotFoundException e) {
Review Comment:
Could we fetch the SCM pipelines once per attempt and let
`LambdaTestUtils.await` handle `PipelineNotFoundException`? It already retries
exceptions and preserves the last one as the timeout cause. This would remove
the try/catch and redundant null check while keeping the missing pipeline ID
available when the test times out.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]