Bug 45499 - Unit tests fail if tcp port 4242 is already used
Summary: Unit tests fail if tcp port 4242 is already used
Status: NEW
Alias: None
Product: Telepathy
Classification: Unclassified
Component: gabble (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Telepathy bugs list
QA Contact: Telepathy bugs list
URL: http://cgit.collabora.com/git/user/al...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-01 05:38 UTC by Alban Crequy
Modified: 2012-04-26 04:07 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
[PATCH 1/2] Tests: use another tcp port if 4242 is already used (4.29 KB, patch)
2012-04-26 02:37 UTC, Alban Crequy
Details | Splinter Review
[PATCH 2/2] Don't use "localhost" for listening: name resolution is not working (3.55 KB, patch)
2012-04-26 02:40 UTC, Alban Crequy
Details | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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...


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.