|
1 | 1 | /** |
2 | | - * © Copyright IBM Corporation 2022, 2023. All Rights Reserved. |
| 2 | + * © Copyright IBM Corporation 2022, 2025. All Rights Reserved. |
3 | 3 | * |
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with |
5 | 5 | * the License. You may obtain a copy of the License at |
@@ -366,8 +366,10 @@ void testStart() { |
366 | 366 | try { |
367 | 367 | // Run for 5 seconds against an infinite stream |
368 | 368 | long count = testFollowerOnThread(testFollower, ChangesFollower.Mode.LISTEN, false, Duration.ofSeconds(5L)); |
369 | | - // Even on a slow test machine we should at least get into the third batch, but hard to predict total changes |
370 | | - Assert.assertTrue(count > 2*ChangesFollower.BATCH_SIZE + 1, "There should be some changes."); |
| 369 | + // Even on a slow test machine we should at least get two batches, but hard to predict total changes |
| 370 | + long expectedMinChanges = 2 * ChangesFollower.BATCH_SIZE; |
| 371 | + Assert.assertTrue(count >= expectedMinChanges, |
| 372 | + String.format("Expected at least %d changes, but found only %d.", expectedMinChanges, count)); |
371 | 373 | } catch(Exception e) { |
372 | 374 | Assert.fail("There should be no exception.", e); |
373 | 375 | } |
@@ -470,8 +472,10 @@ void testStop() { |
470 | 472 | try { |
471 | 473 | // Run for 5 seconds against an infinite stream |
472 | 474 | long count = testFollowerOnThread(testFollower, ChangesFollower.Mode.FINITE, false, Duration.ofSeconds(5L)); |
473 | | - // Even on a slow test machine we should at least get into the third batch, but hard to predict total changes |
474 | | - Assert.assertTrue(count > 2*ChangesFollower.BATCH_SIZE + 1, "There should be some changes."); |
| 475 | + // Even on a slow test machine we should at least get two batches, but hard to predict total changes |
| 476 | + long expectedMinChanges = 2 * ChangesFollower.BATCH_SIZE; |
| 477 | + Assert.assertTrue(count >= expectedMinChanges, |
| 478 | + String.format("Expected at least %d changes, but found only %d.", expectedMinChanges, count)); |
475 | 479 | } catch(Exception e) { |
476 | 480 | Assert.fail("There should be no exception.", e); |
477 | 481 | } |
|
0 commit comments