suztomo commented on issue #11090: [BEAM-9470] :sdks:java:io:kinesis:test is 
flaky
URL: https://github.com/apache/beam/pull/11090#issuecomment-598926854
 
 
   In the test case, the two iterators return the following data:
   
   - firstIterator: `throw(e)`;  `[a, b]`;   `[]`;   `[]`;   `[]`;   `[]` ...
   - secondIterator: `[c]`;   `[d]`;   `[]`;   `[]`;   `[]` ...
   
   The test case waits for 5 elements from shardReadersPool:
   
   ```
       List<KinesisRecord> fetchedRecords = new ArrayList<>();
       while (fetchedRecords.size() < 4) {
         CustomOptional<KinesisRecord> nextRecord = 
shardReadersPool.nextRecord();
         if (nextRecord.isPresent()) {
           fetchedRecords.add(nextRecord.get());
         }
       }
   ```
   
   The test's expectation was:
   
   ```
       verify(customRateLimitPolicy).onThrottle(same(e));
       verify(customRateLimitPolicy).onSuccess(eq(ImmutableList.of(a, b)));
       verify(customRateLimitPolicy).onSuccess(eq(singletonList(c)));
       verify(customRateLimitPolicy).onSuccess(eq(singletonList(d)));
   ```
   
   My assumption: there's no guarantee that 2 elements from firstIterator and 
secondIterator are served evenly when 5 elements are consumed.
   
   My suggestion: make the while loop until it confirms the expected 5 elements 
are in `fetchedRecords` variable.
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to