Skip to content

Commit c1f67f6

Browse files
committed
test: support run inside devcontainer
Signed-off-by: Vladislav Polyakov <[email protected]>
1 parent ec10fcb commit c1f67f6

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

tests/conftest.py

+16-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
@pytest.fixture(scope="module")
1010
def docker_compose_file(pytestconfig):
11-
return os.path.join(str(pytestconfig.rootdir), "docker-compose.yml")
11+
return os.path.join(str(pytestconfig.rootdir), "compose.yml")
1212

1313

1414
def wait_container_ready(driver):
@@ -32,9 +32,14 @@ def wait_container_ready(driver):
3232

3333
@pytest.fixture(scope="module")
3434
def endpoint(pytestconfig, module_scoped_container_getter):
35-
with ydb.Driver(endpoint="localhost:2136", database="/local") as driver:
35+
e = "grpc://localhost:2136"
36+
if os.environ.get('REMOTE_CONTAINERS') is not None:
37+
e = "grpc://py-sdk-ydb:2136"
38+
39+
with ydb.Driver(endpoint=e, database="/local") as driver:
3640
wait_container_ready(driver)
37-
yield "localhost:2136"
41+
42+
yield e
3843

3944

4045
@pytest.fixture(scope="session")
@@ -47,13 +52,19 @@ def secure_endpoint(pytestconfig, session_scoped_container_getter):
4752

4853
assert os.path.exists(ca_path)
4954
os.environ["YDB_SSL_ROOT_CERTIFICATES_FILE"] = ca_path
55+
56+
e = "grpcs://localhost:2135"
57+
if os.environ.get('REMOTE_CONTAINERS') is not None:
58+
e = "grpcs://py-sdk-ydb:2135"
59+
5060
with ydb.Driver(
51-
endpoint="grpcs://localhost:2135",
61+
endpoint=e,
5262
database="/local",
5363
root_certificates=ydb.load_ydb_root_certificate(),
5464
) as driver:
5565
wait_container_ready(driver)
56-
yield "localhost:2135"
66+
67+
yield e
5768

5869

5970
@pytest.fixture(scope="module")

tests/ssl/test_ssl.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
# -*- coding: utf-8 -*-
2+
import os
23
import ydb
34
import pytest
45

56

67
@pytest.mark.tls
78
def test_connect_secure(secure_endpoint, database):
89
with ydb.Driver(
9-
endpoint="grpcs://localhost:2135",
10-
database="/local",
10+
endpoint=secure_endpoint,
11+
database=database,
1112
root_certificates=ydb.load_ydb_root_certificate(),
1213
) as driver:
1314
driver.wait(timeout=10)

0 commit comments

Comments
 (0)