diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2013-02-12 10:21:54 +0000 |
---|---|---|
committer | Will Thompson <will.thompson@collabora.co.uk> | 2013-02-12 10:21:54 +0000 |
commit | 0bffd2d8302d81a804f5186f17445abae16b1d85 (patch) | |
tree | bf839104b142e04b21c589cd19901094682a2690 /tests | |
parent | 0d65aee3d0c72ebf4c2713945524ae5b80e01c08 (diff) |
tests: don't block on Disconnect() without sending </stream>
These three tests were making blocking calls to Disconnect() rather than
using the disconnect_conn() helper. As a result, Gabble was waiting 5
seconds for the test server to send back </stream:stream> before timing
out. Using disconnect_conn(), which sends the stream close back
properly, shaves between 15 and 18 wasted seconds off the test suite.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/twisted/jingle/call-muc-cancel.py | 4 | ||||
-rw-r--r-- | tests/twisted/vcard/overlapping-sets.py | 5 | ||||
-rw-r--r-- | tests/twisted/vcard/set-set-disconnect.py | 8 |
3 files changed, 8 insertions, 9 deletions
diff --git a/tests/twisted/jingle/call-muc-cancel.py b/tests/twisted/jingle/call-muc-cancel.py index 62fa006c3..36fb23891 100644 --- a/tests/twisted/jingle/call-muc-cancel.py +++ b/tests/twisted/jingle/call-muc-cancel.py @@ -2,7 +2,7 @@ Test closing the muc channel while a muji request is in flight """ -from gabbletest import exec_test +from gabbletest import exec_test, disconnect_conn from servicetest import call_async import constants as cs @@ -25,7 +25,7 @@ def run_cancel_test(q, bus, conn, stream): q.expect('stream-presence', to = muc + "/test") - conn.Disconnect() + disconnect_conn(q, conn, stream) if __name__ == '__main__': exec_test (run_cancel_test) diff --git a/tests/twisted/vcard/overlapping-sets.py b/tests/twisted/vcard/overlapping-sets.py index e9676de4a..a57ca9cc4 100644 --- a/tests/twisted/vcard/overlapping-sets.py +++ b/tests/twisted/vcard/overlapping-sets.py @@ -8,7 +8,7 @@ from servicetest import (EventPattern, call_async, sync_dbus, assertEquals, assertLength) from gabbletest import ( acknowledge_iq, exec_test, expect_and_handle_get_vcard, make_result_iq, - sync_stream) + sync_stream, disconnect_conn) import ns def test(q, bus, conn, stream): @@ -129,8 +129,7 @@ def test(q, bus, conn, stream): # Now Gabble gets disconnected. sync_stream(q, stream) - conn.Disconnect() - q.expect('dbus-signal', signal='StatusChanged', args=[2, 1]) + disconnect_conn(q, conn, stream) if __name__ == '__main__': exec_test(test) diff --git a/tests/twisted/vcard/set-set-disconnect.py b/tests/twisted/vcard/set-set-disconnect.py index b7b73151d..e35ee9744 100644 --- a/tests/twisted/vcard/set-set-disconnect.py +++ b/tests/twisted/vcard/set-set-disconnect.py @@ -4,7 +4,7 @@ Regression test for crash when disconnecting in the middle of a set. """ from servicetest import EventPattern, call_async, sync_dbus -from gabbletest import exec_test, acknowledge_iq, expect_and_handle_get_vcard, sync_stream +from gabbletest import exec_test, acknowledge_iq, expect_and_handle_get_vcard, sync_stream, disconnect_conn import constants as cs def test(q, bus, conn, stream): @@ -18,9 +18,9 @@ def test(q, bus, conn, stream): 'stream-iq', iq_type='set', query_ns='vcard-temp', query_name='vCard') call_async( q, conn.Avatars, 'SetAvatar', 'LeChuck.brush', 'image/x-ghost-pirate') - conn.Disconnect() - q.expect('dbus-signal', signal='StatusChanged', - args=[cs.CONN_STATUS_DISCONNECTED, cs.CSR_REQUESTED]), + + disconnect_conn(q, conn, stream) + q.expect('dbus-error', method='SetAvatar', name=cs.NOT_AVAILABLE) q.expect('dbus-error', method='SetAvatar', name=cs.NOT_AVAILABLE) sync_dbus(bus, q, conn) |