How to use __resolve_hostname_and_test method in yandex-tank

Best Python code snippet using yandex-tank

test_util.py

Source:test_util.py Github

copy

Full Screen

...67 def __resolve(chunk):68 aw = AddressWizard()69 # return format: is_v6, parsed_ip, int(port), address_str70 return aw.resolve(chunk)71 def __resolve_hostname_and_test(self, address_str, test_hostname, test_port):72 passed = False73 try:74 resolved = socket.getaddrinfo(test_hostname, test_port)75 except Exception:76 # skip this check if resolver not available77 return True78 try:79 for i in resolved:80 if i[4][1] == self.__resolve(address_str)[2] and i[4][0] == self.__resolve(address_str)[1]:81 passed = True82 except IndexError:83 pass84 assert passed85 # ipv686 def test_ipv6(self):87 assert self.__resolve('2a02:6b8::2:242') == (True, '2a02:6b8::2:242', 80, '2a02:6b8::2:242')88 def test_ipv6_braces_port(self):89 assert self.__resolve('[2a02:6b8::2:242]:666') == (True, '2a02:6b8::2:242', 666, '2a02:6b8::2:242')90 def test_ipv6_braces_port_spaces(self):91 assert self.__resolve('[ 2a02:6b8::2:242 ]: 666') == (True, '2a02:6b8::2:242', 666, '2a02:6b8::2:242')92 def test_ipv4(self):93 assert self.__resolve('87.250.250.242') == (False, '87.250.250.242', 80, '87.250.250.242')94 def test_ipv4_port(self):95 assert self.__resolve('87.250.250.242:666') == (False, '87.250.250.242', 666, '87.250.250.242')96 def test_ipv4_braces_port(self):97 assert self.__resolve('[87.250.250.242]:666') == (False, '87.250.250.242', 666, '87.250.250.242')98 # hostname99 def test_hostname_port(self):100 self.__resolve_hostname_and_test('ya.ru:666', 'ya.ru', '666')101 def test_hostname_braces(self):102 self.__resolve_hostname_and_test('[ya.ru]', 'ya.ru', '80')103 def test_hostname_braces_port(self):104 self.__resolve_hostname_and_test('[ya.ru]:666', 'ya.ru', '666')105class TestFileMultiReader(object):106 filename = 'yandextank/common/tests/ph.out'107 @staticmethod108 def mock_consumer(f, expected, step, errors):109 for line in [expected[i: i + step] for i in range(0, len(expected), step)]:110 res = f.read(step)111 if line not in res:112 errors.append("Expected: {}\nGot: {}".format(expected, res))113 @staticmethod114 def mock_complex_consumer(f, expected, n_steps, errors):115 for n in range(n_steps):116 f.read()117 res = f.readline() + f.read(10)118 if res != expected:...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run yandex-tank automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful