Bug 25257

Summary: race condition sometimes causes muc/test-muc-ownership.py to time out
Product: Telepathy Reporter: Simon McVittie <smcv>
Component: gabbleAssignee: Simon McVittie <smcv>
Status: RESOLVED WORKSFORME QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: normal    
Priority: medium Keywords: patch
Version: unspecified   
Hardware: Other   
OS: All   
URL: http://git.collabora.co.uk/?p=user/smcv/telepathy-gabble-smcv.git;a=shortlog;h=refs/heads/muc-test
Whiteboard:
i915 platform: i915 features:

Description Simon McVittie 2009-11-24 05:54:28 UTC
I ran into this while forward-porting the fix for Bug #25243 to master, and thought I should fix it while it was (briefly) reproducible...

commit 1dc0cee033d5d3eacc553fb8e891be152bc70cd7
Author: Simon McVittie <simon.mcvittie@collabora.co.uk>
Date:   2009-11-24 13:51:21 +0000

    muc/test-muc-ownership.py: unrace a test
    
    If the second GroupFlagsChanged was processed before the stream-presence
    (relative order of D-Bus and stream events can't be guaranteed since
    they're on different sockets), then the test would time out.

diff --git a/tests/twisted/muc/test-muc-ownership.py b/tests/twisted/muc/test-muc-ownership.py
index e2f9faf..1b48ee1 100644
--- a/tests/twisted/muc/test-muc-ownership.py
+++ b/tests/twisted/muc/test-muc-ownership.py
@@ -29,15 +29,15 @@ def test(q, bus, conn, stream):
     call_async(q, conn, 'RequestChannel', cs.CHANNEL_TYPE_TEXT, cs.HT_ROOM,
         room_handle, True)
 
-    gfc, _, _ = q.expect_many(
-        EventPattern('dbus-signal', signal='GroupFlagsChanged'),
+    q.expect_many(
+        EventPattern('dbus-signal', signal='GroupFlagsChanged',
+            predicate=lambda e: e.args[1] == 0),
         EventPattern('dbus-signal', signal='MembersChanged',
             args=[u'', [], [], [], [2], 0, 0]),
-        EventPattern('stream-presence', to='chat@conf.localhost/test'))
-    assert gfc.args[1] == 0
-
-    event = q.expect('dbus-signal', signal='GroupFlagsChanged')
-    assert event.args == [0, 1]
+        EventPattern('stream-presence', to='chat@conf.localhost/test'),
+        EventPattern('dbus-signal', signal='GroupFlagsChanged',
+            predicate=lambda e: e.args == [0, 1]),
+        )
 
     # Send presence for anonymous other member of room.
     stream.send(make_muc_presence('owner', 'moderator', 'chat@conf.localhost', 'bob'))
Comment 1 Simon McVittie 2009-12-04 04:30:46 UTC
Sjoerd fixed this in a similar way.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.