Skip to content

Commit 84e1c50

Browse files
authored
Merge pull request #218 from Maxteabag/worktree-issue-200-port-probe
Probe binary-protocol ports so fixtures don't hang behind HTTP agents
2 parents 03bd1b3 + 525b4bd commit 84e1c50

14 files changed

Lines changed: 126 additions & 26 deletions

‎tests/fixtures/cockroachdb.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import pytest
99

10-
from tests.fixtures.utils import cleanup_connection, is_port_open, run_cli
10+
from tests.fixtures.utils import cleanup_connection, is_binary_port_open, run_cli
1111

1212
# CockroachDB connection settings for Docker
1313
COCKROACHDB_HOST = os.environ.get("COCKROACHDB_HOST", "localhost")
@@ -19,7 +19,7 @@
1919

2020
def cockroachdb_available() -> bool:
2121
"""Check if CockroachDB is available."""
22-
return is_port_open(COCKROACHDB_HOST, COCKROACHDB_PORT)
22+
return is_binary_port_open(COCKROACHDB_HOST, COCKROACHDB_PORT)
2323

2424

2525
@pytest.fixture(scope="session")

‎tests/fixtures/db2.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import pytest
99

10-
from tests.fixtures.utils import cleanup_connection, is_port_open, run_cli
10+
from tests.fixtures.utils import cleanup_connection, is_binary_port_open, run_cli
1111

1212
DB2_HOST = os.environ.get("DB2_HOST", "localhost")
1313
DB2_PORT = int(os.environ.get("DB2_PORT", "50000"))
@@ -18,7 +18,7 @@
1818

1919
def db2_available() -> bool:
2020
"""Check if Db2 is available."""
21-
return is_port_open(DB2_HOST, DB2_PORT)
21+
return is_binary_port_open(DB2_HOST, DB2_PORT)
2222

2323

2424
@pytest.fixture(scope="session")

‎tests/fixtures/firebird.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import pytest
99

10-
from tests.fixtures.utils import cleanup_connection, is_port_open, run_cli
10+
from tests.fixtures.utils import cleanup_connection, is_binary_port_open, run_cli
1111

1212
FIREBIRD_HOST = os.environ.get("FIREBIRD_HOST", "localhost")
1313
FIREBIRD_PORT = int(os.environ.get("FIREBIRD_PORT", "3050"))
@@ -18,7 +18,7 @@
1818

1919
def firebird_available() -> bool:
2020
"""Check if Firebird is available."""
21-
return is_port_open(FIREBIRD_HOST, FIREBIRD_PORT)
21+
return is_binary_port_open(FIREBIRD_HOST, FIREBIRD_PORT)
2222

2323

2424
@pytest.fixture(scope="session")

‎tests/fixtures/impala.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import pytest
1010

11-
from tests.fixtures.utils import cleanup_connection, is_port_open, run_cli
11+
from tests.fixtures.utils import cleanup_connection, is_binary_port_open, run_cli
1212

1313
IMPALA_HOST = os.environ.get("IMPALA_HOST", "localhost")
1414
IMPALA_PORT = int(os.environ.get("IMPALA_PORT", "21050"))
@@ -18,7 +18,7 @@
1818

1919
def impala_available() -> bool:
2020
"""Check if Impala is available."""
21-
return is_port_open(IMPALA_HOST, IMPALA_PORT)
21+
return is_binary_port_open(IMPALA_HOST, IMPALA_PORT)
2222

2323

2424
@pytest.fixture(scope="session")

‎tests/fixtures/mariadb.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import pytest
99

10-
from tests.fixtures.utils import cleanup_connection, is_port_open, run_cli
10+
from tests.fixtures.utils import cleanup_connection, is_binary_port_open, run_cli
1111

1212
# Note: Using 127.0.0.1 instead of localhost to force TCP connection (localhost uses Unix socket)
1313
MARIADB_HOST = os.environ.get("MARIADB_HOST", "127.0.0.1")
@@ -19,7 +19,7 @@
1919

2020
def mariadb_available() -> bool:
2121
"""Check if MariaDB is available."""
22-
return is_port_open(MARIADB_HOST, MARIADB_PORT)
22+
return is_binary_port_open(MARIADB_HOST, MARIADB_PORT)
2323

2424

2525
@pytest.fixture(scope="session")

‎tests/fixtures/mariadb_charset.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import pytest
99

10-
from tests.fixtures.utils import cleanup_connection, is_port_open, run_cli
10+
from tests.fixtures.utils import cleanup_connection, is_binary_port_open, run_cli
1111

1212
# TIS-620 (Thai) MariaDB
1313
MARIADB_TIS620_HOST = os.environ.get("MARIADB_TIS620_HOST", "127.0.0.1")
@@ -25,12 +25,12 @@
2525

2626
def mariadb_tis620_available() -> bool:
2727
"""Check if MariaDB TIS-620 is available."""
28-
return is_port_open(MARIADB_TIS620_HOST, MARIADB_TIS620_PORT)
28+
return is_binary_port_open(MARIADB_TIS620_HOST, MARIADB_TIS620_PORT)
2929

3030

3131
def mariadb_latin1_available() -> bool:
3232
"""Check if MariaDB Latin1 is available."""
33-
return is_port_open(MARIADB_LATIN1_HOST, MARIADB_LATIN1_PORT)
33+
return is_binary_port_open(MARIADB_LATIN1_HOST, MARIADB_LATIN1_PORT)
3434

3535

3636
@pytest.fixture(scope="session")

‎tests/fixtures/mssql.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import pytest
99

10-
from tests.fixtures.utils import cleanup_connection, is_port_open, run_cli
10+
from tests.fixtures.utils import cleanup_connection, is_binary_port_open, run_cli
1111

1212
MSSQL_HOST = os.environ.get("MSSQL_HOST", "localhost")
1313
MSSQL_PORT = int(os.environ.get("MSSQL_PORT", "1434"))
@@ -18,7 +18,7 @@
1818

1919
def mssql_available() -> bool:
2020
"""Check if SQL Server is available."""
21-
return is_port_open(MSSQL_HOST, MSSQL_PORT)
21+
return is_binary_port_open(MSSQL_HOST, MSSQL_PORT)
2222

2323

2424
@pytest.fixture(scope="session")

‎tests/fixtures/mysql.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import pytest
99

10-
from tests.fixtures.utils import cleanup_connection, is_port_open, run_cli
10+
from tests.fixtures.utils import cleanup_connection, is_binary_port_open, run_cli
1111

1212
# Note: We use root user because MySQL's testuser only has localhost access inside the container
1313
MYSQL_HOST = os.environ.get("MYSQL_HOST", "localhost")
@@ -19,7 +19,7 @@
1919

2020
def mysql_available() -> bool:
2121
"""Check if MySQL is available."""
22-
return is_port_open(MYSQL_HOST, MYSQL_PORT)
22+
return is_binary_port_open(MYSQL_HOST, MYSQL_PORT)
2323

2424

2525
@pytest.fixture(scope="session")

‎tests/fixtures/mysql_charset.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import pytest
99

10-
from tests.fixtures.utils import cleanup_connection, is_port_open, run_cli
10+
from tests.fixtures.utils import cleanup_connection, is_binary_port_open, run_cli
1111

1212
# TIS-620 (Thai) MySQL
1313
MYSQL_TIS620_HOST = os.environ.get("MYSQL_TIS620_HOST", "localhost")
@@ -25,12 +25,12 @@
2525

2626
def mysql_tis620_available() -> bool:
2727
"""Check if MySQL TIS-620 is available."""
28-
return is_port_open(MYSQL_TIS620_HOST, MYSQL_TIS620_PORT)
28+
return is_binary_port_open(MYSQL_TIS620_HOST, MYSQL_TIS620_PORT)
2929

3030

3131
def mysql_latin1_available() -> bool:
3232
"""Check if MySQL Latin1 is available."""
33-
return is_port_open(MYSQL_LATIN1_HOST, MYSQL_LATIN1_PORT)
33+
return is_binary_port_open(MYSQL_LATIN1_HOST, MYSQL_LATIN1_PORT)
3434

3535

3636
@pytest.fixture(scope="session")

‎tests/fixtures/oracle.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import pytest
99

10-
from tests.fixtures.utils import cleanup_connection, is_port_open, run_cli
10+
from tests.fixtures.utils import cleanup_connection, is_binary_port_open, run_cli
1111

1212
# Oracle connection settings for Docker
1313
ORACLE_HOST = os.environ.get("ORACLE_HOST", "localhost")
@@ -19,7 +19,7 @@
1919

2020
def oracle_available() -> bool:
2121
"""Check if Oracle is available."""
22-
return is_port_open(ORACLE_HOST, ORACLE_PORT)
22+
return is_binary_port_open(ORACLE_HOST, ORACLE_PORT)
2323

2424

2525
@pytest.fixture(scope="session")

0 commit comments

Comments
 (0)