From 0364f77b9a85d298c772946b4fdfa67cc936cadb Mon Sep 17 00:00:00 2001 From: Stas Kelvich Date: Fri, 28 Apr 2023 13:51:11 +0300 Subject: [PATCH] fix python styling --- test_runner/fixtures/neon_fixtures.py | 30 ++++++++++++++----- test_runner/regress/test_metric_collection.py | 6 ++-- test_runner/regress/test_sni_router.py | 13 ++++---- 3 files changed, 33 insertions(+), 16 deletions(-) diff --git a/test_runner/fixtures/neon_fixtures.py b/test_runner/fixtures/neon_fixtures.py index a0914794b2..67838ca218 100644 --- a/test_runner/fixtures/neon_fixtures.py +++ b/test_runner/fixtures/neon_fixtures.py @@ -1824,10 +1824,22 @@ class VanillaPostgres(PgProtocol): assert not self.running # generate self-signed certificate subprocess.run( - ["openssl", "req", "-new", "-x509", "-days", "365", "-nodes", "-text", - "-out", self.pgdatadir / "server.crt", - "-keyout", self.pgdatadir / "server.key", - "-subj", "/CN=localhost"] + [ + "openssl", + "req", + "-new", + "-x509", + "-days", + "365", + "-nodes", + "-text", + "-out", + self.pgdatadir / "server.crt", + "-keyout", + self.pgdatadir / "server.key", + "-subj", + "/CN=localhost", + ] ) # configure postgresql.conf self.configure( @@ -2175,7 +2187,9 @@ class NeonProxy(PgProtocol): @pytest.fixture(scope="function") -def link_proxy(port_distributor: PortDistributor, neon_binpath: Path, test_output_dir: Path) -> Iterator[NeonProxy]: +def link_proxy( + port_distributor: PortDistributor, neon_binpath: Path, test_output_dir: Path +) -> Iterator[NeonProxy]: """Neon proxy that routes through link auth.""" http_port = port_distributor.get_port() @@ -2196,8 +2210,10 @@ def link_proxy(port_distributor: PortDistributor, neon_binpath: Path, test_outpu @pytest.fixture(scope="function") def static_proxy( - vanilla_pg: VanillaPostgres, port_distributor: PortDistributor, neon_binpath: Path, - test_output_dir: Path + vanilla_pg: VanillaPostgres, + port_distributor: PortDistributor, + neon_binpath: Path, + test_output_dir: Path, ) -> Iterator[NeonProxy]: """Neon proxy that routes directly to vanilla postgres.""" diff --git a/test_runner/regress/test_metric_collection.py b/test_runner/regress/test_metric_collection.py index d596e32a8a..54cd86dc84 100644 --- a/test_runner/regress/test_metric_collection.py +++ b/test_runner/regress/test_metric_collection.py @@ -201,8 +201,10 @@ def proxy_metrics_handler(request: Request) -> Response: @pytest.fixture(scope="session") def proxy_with_metric_collector( - port_distributor: PortDistributor, neon_binpath: Path, httpserver_listen_address, - test_output_dir: Path + port_distributor: PortDistributor, + neon_binpath: Path, + httpserver_listen_address, + test_output_dir: Path, ) -> Iterator[NeonProxy]: """Neon proxy that routes through link auth and has metric collection enabled.""" diff --git a/test_runner/regress/test_sni_router.py b/test_runner/regress/test_sni_router.py index 59b64492c6..d930f8cd4c 100644 --- a/test_runner/regress/test_sni_router.py +++ b/test_runner/regress/test_sni_router.py @@ -2,11 +2,9 @@ import socket import subprocess from pathlib import Path from types import TracebackType -from typing import Any, Dict, Iterator, List, Optional, Tuple, Type, Union, cast +from typing import Optional, Type import backoff # type: ignore -import psycopg2 -import pytest from fixtures.log_helper import log from fixtures.neon_fixtures import PgProtocol, PortDistributor, VanillaPostgres @@ -57,8 +55,8 @@ class PgSniRouter(PgProtocol): args = [ str(self.neon_binpath / "pg_sni_router"), *["--listen", f"127.0.0.1:{self.port}"], - *["--tls-cert", self.tls_cert], - *["--tls-key", self.tls_key], + *["--tls-cert", str(self.tls_cert)], + *["--tls-key", str(self.tls_key)], *["--destination", self.destination], ] @@ -105,9 +103,10 @@ def test_pg_sni_router( neon_binpath: Path, test_output_dir: Path, ): - generate_tls_cert( - "endpoint.namespace.localtest.me", test_output_dir / "router.crt", test_output_dir / "router.key" + "endpoint.namespace.localtest.me", + test_output_dir / "router.crt", + test_output_dir / "router.key", ) # Start a stand-alone Postgres to test with