Skip to content
This repository has been archived by the owner on Dec 13, 2019. It is now read-only.

Flaky test: tests/python/twitter/common/metrics/test_sampling.py:test_sampler_base #430

Open
kwlzn opened this issue May 10, 2016 · 0 comments

Comments

@kwlzn
Copy link
Contributor

kwlzn commented May 10, 2016

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant