commons
commons copied to clipboard
Flaky test: tests/python/twitter/common/metrics/test_sampling.py:test_sampler_base
this can manifest in CI as:
tests/python/twitter/common/metrics/test_sampling.py F..
tests/python/twitter/common/metrics/test_gauges.py ......
==================== FAILURES ====================
_______________ test_sampler_base ________________
def test_sampler_base():
class TestSampler(SamplerBase):
def __init__(self, period, clock):
self.count = 0
SamplerBase.__init__(self, period, clock)
def iterate(self):
self.count += 1
test_clock = ThreadedClock()
sampler = TestSampler(Amount(1, Time.SECONDS), clock=test_clock)
sampler.start()
assert test_clock.converge(threads=[sampler])
test_clock.assert_waiting(sampler, 1)
test_clock.tick(0.5)
assert test_clock.converge(threads=[sampler])
assert sampler.count == 0
test_clock.tick(0.5)
assert test_clock.converge(threads=[sampler])
assert sampler.count == 1
test_clock.tick(5)
assert test_clock.converge(threads=[sampler])
> assert sampler.count == 6
E assert 2 == 6
E + where 2 = <TestSampler(Thread-1 [TID=5876], started daemon 140429632481024)>.count
tests/python/twitter/common/metrics/test_sampling.py:58: AssertionError
-------------- Captured stderr call --------------
[<twitter.common.testing.clock.ThreadedClock object at 0x2dd1990>] Time now: 0.0
[<twitter.common.testing.clock.ThreadedClock object at 0x2dd1990>] Time now: 0.0
[<twitter.common.testing.clock.ThreadedClock object at 0x2dd1990>] Time now: 0.5
[<twitter.common.testing.clock.ThreadedClock object at 0x2dd1990>] Time now: 0.5
[<twitter.common.testing.clock.ThreadedClock object at 0x2dd1990>] Time now: 1.0
[<twitter.common.testing.clock.ThreadedClock object at 0x2dd1990>] Time now: 1.0
[<twitter.common.testing.clock.ThreadedClock object at 0x2dd1990>] Time now: 1.0
[<twitter.common.testing.clock.ThreadedClock object at 0x2dd1990>] Time now: 2.0
[<twitter.common.testing.clock.ThreadedClock object at 0x2dd1990>] Time now: 6.0
1 failed, 21 passed, 1 warnings in 0.44 seconds =
but succeeds on rebuild.