Bug #10880

[Tests] Fix flaky test test_callback (tests.test_events.PollClientTestCase)

Added by Tom Clegg over 4 years ago. Updated over 4 years ago.

Status:
Resolved
Priority:
Normal
Assigned To:
Category:
Tests
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:
Story points:
-

Description

Example: https://ci.curoverse.com/job/run-tests-remainder/540/consoleFull

======================================================================
FAIL: test_callback (tests.test_events.PollClientTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/data/1/jenkins/workspace/run-tests-remainder/sdk/python/tests/test_events.py", line 340, in test_callback
    self.assertTrue(self.callback_called.wait(self.TEST_TIMEOUT))
AssertionError: False is not true

----------------------------------------------------------------------

Associated revisions

Revision 99b571c9
Added by Tom Clegg over 4 years ago

Merge branch '10880-poll-test-races'

closes #10880

History

#1 Updated by Tom Clegg over 4 years ago

  • Category set to Tests
  • Assigned To set to Tom Clegg

10880-poll-test-races at b97d14dbd377cc73854eefe77d6450859a41f6b7

copied from commit message:

The polling tests were broken because the API stub was returning its
fake events during the "find recent log ID" probe, so they were being
thrown away by PollClient and never sent to the test case's callback
function.

Most of the tests kept passing anyway, though, because subscribe()
itself sends a synthetic {'status':200} event, and this was being
misconstrued as confirmation that an event had been retrieved from the
API stub.

The false positive was not reliable for test_callback(), though,
because it cleared callback_called and tested another event without
calling subscribe() again. Sometimes, because the first "wait for
event" wasn't really waiting, the test would feed the second event to
the stub before PollClient had a chance to do its ID probe, so both
events would be dropped and the second "wait for event" would fail.

With the "wait for event" code fixed, it is no longer necessary to
close the poll client before checking which filters were used to
retrieve events.

#2 Updated by Tom Clegg over 4 years ago

  • Description updated (diff)

#3 Updated by Tom Clegg over 4 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 0 to 100

Applied in changeset arvados|commit:99b571c9050f28525427c100f9072159a3145bc7.

Also available in: Atom PDF