Skip to content

Commit e3ee815

Browse files
authored
chore: add force_data_generation environment variable (#69)
* chore: add force_data_generation environment variable * fix: add force_data_generation environment variable to remaining tests --------- Co-authored-by: Michał Sośnicki <michal.sosnicki@neptune.ai>
1 parent 8bd9204 commit e3ee815

File tree

4 files changed

+40
-24
lines changed

4 files changed

+40
-24
lines changed

.github/workflows/tests-e2e.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ on:
44
schedule:
55
- cron: '0 8 * * *' # Run at 8:00 daily
66
workflow_dispatch:
7+
inputs:
8+
force_data_generation:
9+
description: 'Force data generation (skip experiment existence check)'
10+
required: false
11+
default: false
12+
type: boolean
713
push:
814
branches:
915
- main
@@ -51,6 +57,7 @@ jobs:
5157
NEPTUNE_E2E_WORKSPACE: ${{ secrets.E2E_WORKSPACE }}
5258
NEPTUNE_E2E_PROJECT: ${{ secrets[format('E2E_PROJECT{0}', matrix.env_suffix)] }}
5359
NEPTUNE_E2E_API_TOKEN: ${{ secrets[format('E2E_API_TOKEN{0}', matrix.env_suffix)] }}
60+
NEPTUNE_E2E_FORCE_DATA_GENERATION: ${{ inputs.force_data_generation || 'false' }}
5461
TEST_MARKERS: ${{ matrix.test_markers }}
5562
run: |
5663
pytest --junitxml="test-results/test-e2e.xml" ${TEST_MARKERS:+-m "$TEST_MARKERS"} tests/e2e

tests/e2e/conftest.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,18 +84,21 @@ def project():
8484
@pytest.fixture(scope="module")
8585
def run_with_attributes(project, api_token, client):
8686
runs = {}
87+
force_data_generation = os.getenv("NEPTUNE_E2E_FORCE_DATA_GENERATION", "").lower() in ("true", "1", "yes")
88+
8789
for experiment in TEST_DATA.experiments:
8890
project_id = project.project_identifier
8991

90-
existing = next(
91-
fetch_experiment_sys_attrs(
92-
client,
93-
identifiers.ProjectIdentifier(project_id),
94-
_Filter.name_eq(experiment.name),
92+
if not force_data_generation:
93+
existing = next(
94+
fetch_experiment_sys_attrs(
95+
client,
96+
identifiers.ProjectIdentifier(project_id),
97+
_Filter.name_eq(experiment.name),
98+
)
9599
)
96-
)
97-
if existing.items:
98-
continue
100+
if existing.items:
101+
continue
99102

100103
run = Run(
101104
api_token=api_token,

tests/e2e/internal/composition/test_attributes.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
import re
23
import time
34
from datetime import (
@@ -42,15 +43,17 @@ def run_with_attributes(client, api_token, project):
4243

4344
project_identifier = project.project_identifier
4445

45-
existing = next(
46-
fetch_experiment_sys_attrs(
47-
client,
48-
identifiers.ProjectIdentifier(project_identifier),
49-
_Filter.name_eq(EXPERIMENT_NAME),
46+
force_data_generation = os.getenv("NEPTUNE_E2E_FORCE_DATA_GENERATION", "").lower() in ("true", "1", "yes")
47+
if not force_data_generation:
48+
existing = next(
49+
fetch_experiment_sys_attrs(
50+
client,
51+
identifiers.ProjectIdentifier(project_identifier),
52+
_Filter.name_eq(EXPERIMENT_NAME),
53+
)
5054
)
51-
)
52-
if existing.items:
53-
return
55+
if existing.items:
56+
return
5457

5558
run_id = str(uuid.uuid4())
5659

tests/e2e/internal/composition/test_type_inference.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
from datetime import (
23
datetime,
34
timezone,
@@ -35,15 +36,17 @@ def run_with_attributes(client, api_token, project):
3536

3637
project_identifier = project.project_identifier
3738

38-
existing = next(
39-
fetch_experiment_sys_attrs(
40-
client,
41-
identifiers.ProjectIdentifier(project_identifier),
42-
_Filter.name_eq(EXPERIMENT_NAME),
39+
force_data_generation = os.getenv("NEPTUNE_E2E_FORCE_DATA_GENERATION", "").lower() in ("true", "1", "yes")
40+
if not force_data_generation:
41+
existing = next(
42+
fetch_experiment_sys_attrs(
43+
client,
44+
identifiers.ProjectIdentifier(project_identifier),
45+
_Filter.name_eq(EXPERIMENT_NAME),
46+
)
4347
)
44-
)
45-
if existing.items:
46-
return
48+
if existing.items:
49+
return
4750

4851
run_id = str(uuid.uuid4())
4952

0 commit comments

Comments
 (0)