Skip to content

Commit e6a19d4

Browse files
authored
Merge pull request #589 from Labelbox/jt/al-2587
[AL-2587] Test-Custom Staging
2 parents f28901d + 122762c commit e6a19d4

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,11 @@ test-onprem: build
3131
-e LABELBOX_TEST_API_KEY_ONPREM=${LABELBOX_TEST_API_KEY_ONPREM} \
3232
-e LABELBOX_TEST_ONPREM_HOSTNAME=${LABELBOX_TEST_ONPREM_HOSTNAME} \
3333
local/labelbox-python:test pytest $(PATH_TO_TEST)
34+
35+
test-custom: build
36+
docker run -it -v ${PWD}:/usr/src -w /usr/src \
37+
-e LABELBOX_TEST_ENVIRON="custom" \
38+
-e DA_GCP_LABELBOX_API_KEY=${DA_GCP_LABELBOX_API_KEY} \
39+
-e LABELBOX_TEST_API_KEY_CUSTOM=${LABELBOX_TEST_API_KEY_CUSTOM} \
40+
-e LABELBOX_TEST_GRAPHQL_API_ENDPOINT=${LABELBOX_TEST_GRAPHQL_API_ENDPOINT} \
41+
local/labelbox-python:test pytest $(PATH_TO_TEST)

tests/integration/conftest.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class Environ(Enum):
2525
PROD = 'prod'
2626
STAGING = 'staging'
2727
ONPREM = 'onprem'
28+
CUSTOM = 'custom'
2829

2930

3031
@pytest.fixture(scope="session")
@@ -52,6 +53,12 @@ def graphql_url(environ: str) -> str:
5253
if hostname is None:
5354
raise Exception(f"Missing LABELBOX_TEST_ONPREM_INSTANCE")
5455
return f"{hostname}/api/_gql"
56+
elif environ == Environ.CUSTOM:
57+
graphql_api_endpoint = os.environ.get(
58+
'LABELBOX_TEST_GRAPHQL_API_ENDPOINT')
59+
if graphql_api_endpoint is None:
60+
raise Exception(f"Missing LABELBOX_TEST_GRAPHQL_API_ENDPOINT")
61+
return graphql_api_endpoint
5562
return 'http://host.docker.internal:8080/graphql'
5663

5764

@@ -62,6 +69,8 @@ def testing_api_key(environ: str) -> str:
6269
return os.environ["LABELBOX_TEST_API_KEY_STAGING"]
6370
elif environ == Environ.ONPREM:
6471
return os.environ["LABELBOX_TEST_API_KEY_ONPREM"]
72+
elif environ == Environ.CUSTOM:
73+
return os.environ["LABELBOX_TEST_API_KEY_CUSTOM"]
6574
return os.environ["LABELBOX_TEST_API_KEY_LOCAL"]
6675

6776

tox.ini

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,14 @@ deps =
99
pytest < 7.0.0
1010
pytest-cases
1111
pytest-rerunfailures
12-
passenv = LABELBOX_TEST_API_KEY_PROD LABELBOX_TEST_API_KEY_STAGING LABELBOX_TEST_ENVIRON DA_GCP_LABELBOX_API_KEY
12+
passenv =
13+
LABELBOX_TEST_ENVIRON
14+
LABELBOX_TEST_API_KEY_PROD
15+
LABELBOX_TEST_API_KEY_STAGING
16+
LABELBOX_TEST_API_KEY_LOCAL
17+
LABELBOX_TEST_API_KEY_ONPREM
18+
LABELBOX_TEST_API_KEY_CUSTOM
19+
LABELBOX_TEST_GRAPHQL_API_ENDPOINT
20+
DA_GCP_LABELBOX_API_KEY
21+
1322
commands = pytest {posargs}

0 commit comments

Comments
 (0)