Bug 45499

Summary: Unit tests fail if tcp port 4242 is already used
Product: Telepathy Reporter: Alban Crequy <alban.crequy>
Component: gabbleAssignee: Telepathy bugs list <telepathy-bugs>
Status: RESOLVED MOVED QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
URL: http://cgit.collabora.com/git/user/alban/telepathy-gabble.git/log/?h=tcpport-tests
Whiteboard:
i915 platform: i915 features:
Attachments: [PATCH 1/2] Tests: use another tcp port if 4242 is already used
[PATCH 2/2] Don't use "localhost" for listening: name resolution is not working

Description Alban Crequy 2012-02-01 05:38:29 UTC
The twisted tests framework in Gabble listens on tcp port 4242 to simulate a Jabber server. If an application unrelated to unit tests already listens on that port, the tests fail.

The tests could be made more resistant by trying another port if 4242 is busy.

The attached patch on tests/twisted/gabbletest.py fixes the bug for most tests. More work is needed for some tests such as connect/test-fail.py.
Comment 1 Alban Crequy 2012-04-26 02:37:23 UTC
Created attachment 60607 [details] [review]
[PATCH 1/2] Tests: use another tcp port if 4242 is already used
Comment 2 Alban Crequy 2012-04-26 02:40:33 UTC
Created attachment 60608 [details] [review]
[PATCH 2/2] Don't use "localhost" for listening: name resolution is not working

This patch is useful when /etc/hosts does not contain the following line:
127.0.0.1	localhost

I used it to be able to run tests on some computer where I couldn't fix /etc/hosts... I don't know if it worth merging that upstream tbh, but here is the patch :)
Comment 3 Simon McVittie 2012-04-26 04:07:41 UTC
Wouldn't it be better to listenTCP() first, and make_connection afterwards? Then you'd only ever need to call make_connection once...
Comment 4 GitLab Migration User 2019-12-03 19:55:26 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/telepathy/telepathy-gabble/issues/206.

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.