Deleted
Added
test_upstreams_rr.py (1635:97afbb6c5a15) | test_upstreams_rr.py (1654:fc7d0578e124) |
---|---|
1import os 2import re 3 4from conftest import option 5from unit.applications.lang.python import TestApplicationPython 6 7 8class TestUpstreamsRR(TestApplicationPython): 9 prerequisites = {'modules': {'python': 'any'}} 10 11 def setup_method(self): | 1import os 2import re 3 4from conftest import option 5from unit.applications.lang.python import TestApplicationPython 6 7 8class TestUpstreamsRR(TestApplicationPython): 9 prerequisites = {'modules': {'python': 'any'}} 10 11 def setup_method(self): |
12 super().setup_method() 13 | |
14 assert 'success' in self.conf( 15 { 16 "listeners": { 17 "*:7080": {"pass": "upstreams/one"}, 18 "*:7090": {"pass": "upstreams/two"}, 19 "*:7081": {"pass": "routes/one"}, 20 "*:7082": {"pass": "routes/two"}, 21 "*:7083": {"pass": "routes/three"}, --- 364 unchanged lines hidden (view full) --- 386 resps = [0, 0] 387 for _ in range(50): 388 resps[self.get()['status'] % 10] += 1 389 resps[self.post(body='0123456789')['status'] % 10] += 1 390 391 assert sum(resps) == 100, 'post sum' 392 assert abs(resps[0] - resps[1]) <= self.cpu_count, 'post' 393 | 12 assert 'success' in self.conf( 13 { 14 "listeners": { 15 "*:7080": {"pass": "upstreams/one"}, 16 "*:7090": {"pass": "upstreams/two"}, 17 "*:7081": {"pass": "routes/one"}, 18 "*:7082": {"pass": "routes/two"}, 19 "*:7083": {"pass": "routes/three"}, --- 364 unchanged lines hidden (view full) --- 384 resps = [0, 0] 385 for _ in range(50): 386 resps[self.get()['status'] % 10] += 1 387 resps[self.post(body='0123456789')['status'] % 10] += 1 388 389 assert sum(resps) == 100, 'post sum' 390 assert abs(resps[0] - resps[1]) <= self.cpu_count, 'post' 391 |
394 def test_upstreams_rr_unix(self): 395 addr_0 = self.temp_dir + '/sock_0' 396 addr_1 = self.temp_dir + '/sock_1' | 392 def test_upstreams_rr_unix(self, temp_dir): 393 addr_0 = temp_dir + '/sock_0' 394 addr_1 = temp_dir + '/sock_1' |
397 398 assert 'success' in self.conf( 399 { 400 "*:7080": {"pass": "upstreams/one"}, 401 "unix:" + addr_0: {"pass": "routes/one"}, 402 "unix:" + addr_1: {"pass": "routes/two"}, 403 }, 404 'listeners', --- 75 unchanged lines hidden --- | 395 396 assert 'success' in self.conf( 397 { 398 "*:7080": {"pass": "upstreams/one"}, 399 "unix:" + addr_0: {"pass": "routes/one"}, 400 "unix:" + addr_1: {"pass": "routes/two"}, 401 }, 402 'listeners', --- 75 unchanged lines hidden --- |