Skip to content

Commit 05607dd

Browse files
radofuchsRadovan Fuchs
andauthored
LCORE-1472: Lcore 1472 improve ci time (#1498)
* improve timing --------- Co-authored-by: Radovan Fuchs <rfuchs@rfuchs-thinkpadp1gen7.tpb.csb>
1 parent 6acfc16 commit 05607dd

33 files changed

Lines changed: 77 additions & 33 deletions

.github/workflows/e2e_tests.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ jobs:
1111
matrix:
1212
mode: ["server", "library"]
1313
environment: ["ci"]
14-
15-
name: "E2E: ${{ matrix.mode }} mode / ${{ matrix.environment }}"
14+
e2e_group: [1, 2, 3]
15+
16+
name: "E2E: ${{ matrix.mode }} mode / ${{ matrix.environment }} / group ${{ matrix.e2e_group }}"
1617

1718
env:
1819
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
@@ -103,6 +104,7 @@ jobs:
103104
echo "=== Configuration Summary ==="
104105
echo "Deployment mode: ${{ matrix.mode }}"
105106
echo "Environment: ${{ matrix.environment }}"
107+
echo "E2E shard (Makefile test-e2e-tagged): @e2e_group_${{ matrix.e2e_group }} (with not @skip)"
106108
echo "Source config: tests/e2e/configs/run-${{ matrix.environment }}.yaml"
107109
echo ""
108110
echo "=== Configuration Preview ==="
@@ -187,13 +189,15 @@ jobs:
187189
TERM: xterm-256color
188190
FORCE_COLOR: 1
189191
E2E_DEPLOYMENT_MODE: ${{ matrix.mode }}
192+
# Matches Makefile test-e2e-tagged / E2E_BEHAVE_TAG_EXPR (one @e2e_group_* per job).
193+
E2E_BEHAVE_TAG_EXPR: "not @skip and @e2e_group_${{ matrix.e2e_group }}"
190194
run: |
191195
echo "Installing test dependencies..."
192196
pip install uv
193197
uv sync
194198
195-
echo "Running comprehensive e2e test suite..."
196-
make test-e2e
199+
echo "Running e2e tests (E2E_BEHAVE_TAG_EXPR=${E2E_BEHAVE_TAG_EXPR})..."
200+
make test-e2e-tagged
197201
198202
- name: Show logs on failure
199203
if: failure()

Makefile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,19 @@ test-integration: ## Run integration tests tests
3232
test-e2e: ## Run end to end tests for the service
3333
script -q -e -c "uv run behave --color --format pretty --tags=-skip -D dump_errors=true @tests/e2e/test_list.txt"
3434

35-
test-e2e-local: ## Run end to end tests for the service
35+
test-e2e-local: ## Run end to end tests for the service (no script wrapper)
3636
uv run behave --color --format pretty --tags=-skip -D dump_errors=true @tests/e2e/test_list.txt
3737

38+
# Tag-based subsets (@e2e_group_* on feature files). Default runs all groups; override for one shard, e.g.
39+
# E2E_BEHAVE_TAG_EXPR='not @skip and @e2e_group_2' make test-e2e-tagged-local
40+
E2E_BEHAVE_TAG_EXPR ?= not @skip and (e2e_group_1 or e2e_group_2 or e2e_group_3)
41+
42+
test-e2e-tagged: ## Run e2e tests with E2E_BEHAVE_TAG_EXPR (default: all @e2e_group_*)
43+
script -q -e -c "uv run behave --color --format pretty --tags=\"$(E2E_BEHAVE_TAG_EXPR)\" -D dump_errors=true @tests/e2e/test_list.txt"
44+
45+
test-e2e-tagged-local: ## Same as test-e2e-tagged without script wrapper
46+
uv run behave --color --format pretty --tags="$(E2E_BEHAVE_TAG_EXPR)" -D dump_errors=true @tests/e2e/test_list.txt
47+
3848
benchmarks: ## Run benchmarks
3949
uv run python -m pytest -vv tests/benchmarks/
4050

tests/e2e/features/authorized_noop.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@e2e_group_1
12
Feature: Authorized endpoint API tests for the noop authentication module
23

34
Background:

tests/e2e/features/authorized_noop_token.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@Authorized
1+
@e2e_group_2 @Authorized
22
Feature: Authorized endpoint API tests for the noop-with-token authentication module
33

44
Background:

tests/e2e/features/authorized_rh_identity.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@RHIdentity
1+
@e2e_group_3 @RHIdentity
22
Feature: Authorized endpoint API tests for the rh-identity authentication module
33

44
Background:

tests/e2e/features/conversation_cache_v2.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@Authorized
1+
@e2e_group_2 @Authorized
22
Feature: Conversation Cache V2 API tests
33

44
Background:

tests/e2e/features/conversations.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@Authorized
1+
@e2e_group_2 @Authorized
22
Feature: conversations endpoint API tests
33

44
Background:

tests/e2e/features/environment.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
FALLBACK_MODEL = "gpt-4o-mini"
3535
FALLBACK_PROVIDER = "openai"
3636

37+
# Wall-clock start for each feature (on ``Feature``; survives Behave context resets).
38+
_E2E_FEATURE_PERF_START_ATTR = "_lightspeed_e2e_feature_perf_start"
39+
3740

3841
def _fetch_models_from_service() -> dict:
3942
"""Query /v1/models endpoint and return first LLM model.
@@ -349,7 +352,11 @@ def before_feature(context: Context, feature: Feature) -> None:
349352
350353
Per-feature setup that is not expressed in Gherkin (e.g. feedback cleanup state).
351354
Lightspeed YAML is applied in feature Backgrounds via ``configure_service``.
355+
356+
Records monotonic start time on ``feature`` for duration logging in
357+
``after_feature`` (includes scenarios and feature teardown).
352358
"""
359+
setattr(feature, _E2E_FEATURE_PERF_START_ATTR, time.perf_counter())
353360
reset_active_lightspeed_stack_config_basename()
354361
context.active_lightspeed_stack_config_basename = None
355362
# One real Llama disruption per feature (module-level flag; survives context resets)
@@ -398,3 +405,19 @@ def after_feature(context: Context, feature: Feature) -> None:
398405

399406
_stop_proxy(context, "tunnel_proxy", "proxy_loop")
400407
_stop_proxy(context, "interception_proxy", "interception_proxy_loop")
408+
409+
start = getattr(feature, _E2E_FEATURE_PERF_START_ATTR, None)
410+
if start is not None:
411+
elapsed_s = time.perf_counter() - start
412+
try:
413+
delattr(feature, _E2E_FEATURE_PERF_START_ATTR)
414+
except AttributeError:
415+
pass
416+
feat_path = getattr(feature, "filename", "") or ""
417+
label = os.path.basename(feat_path) if feat_path else feature.name
418+
print(f"[e2e feature timing] {elapsed_s:.2f}s {label}", flush=True)
419+
420+
421+
# Behave captures hook stdout by default; output is only shown in some failure paths.
422+
# Disable capture so feature timing lines always appear on the real console/CI log.
423+
after_feature.capture = False # type: ignore[attr-defined]

tests/e2e/features/faiss.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@Authorized
1+
@e2e_group_1 @Authorized
22
Feature: FAISS support tests
33

44
Background:

tests/e2e/features/feedback.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@Feedback
1+
@e2e_group_3 @Feedback
22
Feature: feedback endpoint API tests
33

44

0 commit comments

Comments
 (0)