client-types.py appears to have a race
@wjt
Submitted by Will Thompson Assigned to Telepathy bugs list
Description
Today I pushed a trivial patch to a test to Gabble, and the tests failed on 3 out of the 4 build slaves. Two of them were races, but one of them was a genuine failure http://buildbot.telepathy.im/builders/Gabble%20-%20plugins%20-%20amd64/builds/52:
Traceback (most recent call last): File "/var/lib/buildbot/telepathy/gabble-plugins-amd64/build/tests/twisted/gabbletest.py", line 627, in exec_test_deferred fun(queue, bus, conns[0], streams[0]) File "./client-types.py", line 218, in test2 assertSameSets(['pc'], types[handle]) KeyError: dbus.UInt32(2L) FAIL: client-types.py
tt -r client-types.py
reproduced the issue pretty quickly. It looks like a pretty straight race: contact_online() sends a disco reply but doesn't actually wait around to check that Gabble's actually received it, and immediately afterwards the test asks for handle's client types. So I threw a sync_stream() into the 'not initial' branch of contact_online(). But that still seemed to be racy:
Traceback (most recent call last): File "/home/wjt/src/tp/gabble/tests/twisted/gabbletest.py", line 627, in exec_test_deferred fun(queue, bus, conns[0], streams[0]) File "./client-types.py", line 221, in test2 assertSameSets(['pc'], types[handle]) File "/home/wjt/src/tp/gabble/tests/twisted/servicetest.py", line 565, in assertSameSets pretty(exp_set), pretty(val_set))) AssertionError: expected contents: set(['pc']) got: set([dbus.String(u'phone')]) FAIL: client-types.py
so then I gave up.
Version: git master