From e75fe93d8eecaf24143248361c9d08d73bfb4f04 Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Fri, 4 Nov 2022 20:35:09 +0100 Subject: [PATCH] . --- .github/workflows/test.yml | 2 +- tests/test_ssh_proto.py | 64 +++++++++++++++++++------------------- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 277b895..df6aeb2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -43,7 +43,7 @@ jobs: - name: Run working-directory: tests run: | - TIMEOUT=120 poetry run ./run.sh + TIMEOUT=120 poetry run ./run.sh test_ssh_proto.py::Test::test_direct_tcpip|cat cargo llvm-cov --no-run --hide-instantiations --lcov > coverage.lcov - name: SonarCloud Scan diff --git a/tests/test_ssh_proto.py b/tests/test_ssh_proto.py index 2312b21..385f448 100644 --- a/tests/test_ssh_proto.py +++ b/tests/test_ssh_proto.py @@ -114,40 +114,40 @@ class Test: assert ssh_client.returncode != 0 - # def test_direct_tcpip( - # self, - # processes: ProcessManager, - # wg_port, - # timeout, - # ): - # local_port = alloc_port() - # wait_port(wg_port) - # ssh_client = processes.start_ssh_client( - # '-p', - # str(wg_port), - # '-v', - # *common_args, - # '-L', f'{local_port}:neverssl.com:80', - # '-N', - # password='123', - # ) + def test_direct_tcpip( + self, + processes: ProcessManager, + wg_port, + timeout, + ): + local_port = alloc_port() + wait_port(wg_port) + ssh_client = processes.start_ssh_client( + '-p', + str(wg_port), + '-v', + *common_args, + '-L', f'{local_port}:neverssl.com:80', + '-N', + password='123', + ) - # wait_port(local_port, recv=False) - # for _ in range(15): - # time.sleep(1) - # try: - # response = requests.get(f'http://localhost:{local_port}', timeout=timeout) - # except Exception: - # continue - # if response.status_code == 200: - # break + wait_port(local_port, recv=False) + for _ in range(15): + time.sleep(1) + try: + response = requests.get(f'http://localhost:{local_port}', timeout=timeout) + except Exception: + continue + if response.status_code == 200: + break - # s = requests.Session() - # retries = requests.adapters.Retry(total=5, backoff_factor=1) - # s.mount('http://', requests.adapters.HTTPAdapter(max_retries=retries)) - # response = s.get(f'http://localhost:{local_port}', timeout=timeout) - # assert response.status_code == 200 - # ssh_client.kill() + s = requests.Session() + retries = requests.adapters.Retry(total=5, backoff_factor=1) + s.mount('http://', requests.adapters.HTTPAdapter(max_retries=retries)) + response = s.get(f'http://localhost:{local_port}', timeout=timeout) + assert response.status_code == 200 + ssh_client.kill() def test_tcpip_forward( self,