Skip to content

Commit bf82241

Browse files
committed
feat: properly handle ci conditions
1 parent da1b8cb commit bf82241

File tree

4 files changed

+18
-2
lines changed

4 files changed

+18
-2
lines changed

.github/workflows/nightly_docker_test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ env:
2727
ANSRV_GEO_PORT: 710
2828
ANSRV_GEO_LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }}
2929
GEO_CONT_NAME: ans_geo_nightly
30+
IS_WORKFLOW_RUNNING: true
3031

3132
concurrency:
3233
group: ${{ github.workflow }}-${{ github.ref }}

.github/workflows/v1_testing.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ env:
99
ANSRV_GEO_LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }}
1010
GEO_CONT_NAME: ans_geo
1111
RESET_IMAGE_CACHE: 0
12+
IS_WORKFLOW_RUNNING: true
1213

1314
permissions:
1415
contents: read

tests/conftest.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def pytest_addoption(parser):
7575
default="latest",
7676
help=("Specify the backend version to use for the tests. By default, 'latest'."),
7777
)
78-
78+
7979
parser.addoption(
8080
"--transport-mode",
8181
action="store",
@@ -179,13 +179,27 @@ def proto_version(request):
179179
value: str = request.config.getoption("--proto-version", default="v0")
180180
return value.lower()
181181

182+
182183
@pytest.fixture(scope="session")
183184
def tranport_mode(request):
184185
"""Fixture to determine transport mode to be used."""
186+
import os
187+
import warnings
188+
185189
value: str = request.config.getoption("--transport-mode", default="default")
186190
mode = None if value.lower() == "default" else value.lower()
191+
192+
if os.environ.get("IS_WORKFLOW_RUNNING") == "true":
193+
# When running in CI, force transport mode to insecure for simplicity
194+
mode = "insecure"
195+
warnings.warn(
196+
"Transport mode forced to 'insecure' when running in CI workflows.",
197+
UserWarning,
198+
)
199+
187200
return mode
188201

202+
189203
@pytest.fixture
190204
def fake_record():
191205
def inner_fake_record(

tests/integration/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def docker_instance(use_existing_service, transport_mode):
152152
connect_to_existing_service=True,
153153
restart_if_existing_service=True,
154154
image=is_image_available_cont,
155-
transport_mode=transport_mode
155+
transport_mode=transport_mode,
156156
)
157157

158158
return docker_instance

0 commit comments

Comments
 (0)