randomize proxy port to improve chances of unit tests passing

This commit is contained in:
Arvid Norberg
2012-06-09 16:58:16 +00:00
parent fa1c071c2f
commit f6450b91bb
5 changed files with 14 additions and 13 deletions

View File

@@ -247,13 +247,11 @@ void test_transfer(int proxy_type, bool test_disk_full = false, bool test_allowe
session ses1(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48075, 49000), "0.0.0.0", 0, alert_mask);
session ses2(fingerprint("LT", 0, 1, 0, 0), std::make_pair(49075, 50000), "0.0.0.0", 0, alert_mask);
int proxy_port = (rand() % 30000) + 10000;
proxy_settings ps;
if (proxy_type)
{
start_proxy(proxy_port, proxy_type);
proxy_settings ps;
ps.port = start_proxy(proxy_type);
ps.hostname = "127.0.0.1";
ps.port = proxy_port;
ps.username = "testuser";
ps.password = "testpass";
ps.type = (proxy_settings::proxy_type)proxy_type;
@@ -585,7 +583,7 @@ void test_transfer(int proxy_type, bool test_disk_full = false, bool test_allowe
stop_tracker();
stop_web_server();
}
if (proxy_type) stop_proxy(proxy_port);
if (proxy_type) stop_proxy(ps.port);
}
int test_main()