Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

fix(test): testThrottlingBlocking flakyness fix #1775

Merged
merged 2 commits into from Aug 22, 2022
Merged

Commits on Aug 16, 2022

  1. fix(test): testThrottlingBlocking flakyness fix

    When BatcherImpl.sendOutstanding (method that calls callContext.withOption) is called from PushCurrentBatchRunnable, it uses
    the batcher's own executor, causing the mockito capture to fail due to be in a different
    thread from the one that originated add(). Other times, sendOutstanding will be called from the parent
    thread (successful test, in this case from our newFixedThreadPool).
    ALthough this is expected behavior, the argument captors do not work
    when used in different threads. Mockito.verify() is the recommended way
    of dealing with argument captors and happened to be the fix
    Internally, verify() relies on thread safe(r) notifiers for when the captors have been interacted with.
    When verifying flakiness, 100 runs in two threads were used with
    bazel test //gax:com.google.api.gax.batching.BatcherImplTest --runs_per_test=100 --test_filter Throttling --jobs 2
    
    Mockito.verify() implementation:
    https://github.com/mockito/mockito/blob/2ded10ec704f2c93648d976031c2520a5a9b84aa/src/main/java/org/mockito/internal/MockitoCore.java#L183
    diegomarquezp committed Aug 16, 2022
    Copy the full SHA
    bffb72d View commit details
    Browse the repository at this point in the history
  2. Copy the full SHA
    8f34c53 View commit details
    Browse the repository at this point in the history