Skip to content

Feat/download report - #94

Open
KarenFlorykian wants to merge 12 commits into
masterfrom
feat/download-report
Open

Feat/download report#94
KarenFlorykian wants to merge 12 commits into
masterfrom
feat/download-report

Conversation

@KarenFlorykian

Copy link
Copy Markdown

Added the ability to download gatling report

KarenFlorykian and others added 2 commits July 13, 2026 13:31
When --download_report=True (opt-in, default False), control_tower will
locate and download the Gatling HTML/ZIP report from Carrier artifact
storage to the local workspace after the test run completes.

Key changes:
- constants.py: DOWNLOAD_REPORT env-var constant
- run.py: -dr/--download_report CLI flag (mirrors -j/--junit pattern)
- run.py: download_gatling_report() — lists bucket and matches ZIP by
  prefix (reports_{DISTRIBUTED_MODE_PREFIX}), since the Lg_{R}_{R}
  suffix is non-deterministic (bash $RANDOM in perfgun container)
- run.py: process_gatling_report() — derives results bucket from
  job_name, calls download helper, writes ZIP to --report_path
- run.py: implicit save_reports=True override when download_report=True
- run.py: append_test_config propagates download_report from test JSON
- tests/test_download_report.py: 17 TDD tests (RED→GREEN confirmed)

Default behaviour is unchanged (download_report=False).
…, add makedirs guard

- FIX 1: argparse -dr/--download_report now uses DOWNLOAD_REPORT constant as
  its default so the env-var is honoured without a CLI flag
- FIX 2: remove inline `import re as _re` inside process_gatling_report;
  use module-level re throughout
- FIX 3: add os.makedirs(args.report_path, exist_ok=True) at the top of
  process_gatling_report so the target directory is always created
- TEST: add test_download_report_env_var_default_wired_to_argparse to
  verify FIX 1 (patches run.DOWNLOAD_REPORT=True, calls arg_parse()
  with no flags, asserts download_report=True)

All 19 tests in tests/test_download_report.py pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@KarenFlorykian
KarenFlorykian requested a review from hunkom July 13, 2026 13:48
KarenFlorykian and others added 10 commits July 13, 2026 17:07
… unavailable on Node 24 runners)

actions/setup-python@v2 no longer provides Python 3.8.5 on GitHub's Node 24
runners. Update both main.yml and build_lambda.yml to use @v5 and drop the
patch version (3.8.5 -> '3.8') and explicit architecture pin so the action
selects the latest available 3.8.x.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- C1: replace silent `except Exception: pass` with logger.warning to surface
  JSON parse failures in the listing response
- C2: add explicit logger.warning when listing returns a non-200 HTTP status,
  so retry loops leave a visible trace in logs for bucket/auth failures

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- requirements-dev.txt: add git+https://github.com/carrier-io/loki_logger.git
  so centry_loki is available during CI test collection (fixes ModuleNotFoundError)

- tests/test_run.py: update test_start_job to match current run.py API:
  - correct mock URLs to /api/v1/shared/job_type and /api/v1/backend_performance/*
  - fix test_response fixture (job_name: DemoTest, artifact as dict)
  - add missing PUT/GET mocks for report_status
  - mock log_loki to prevent global logger contamination across tests
  - update task count assertion (lg_count + 1 post_process task)
  - remove stale callback assertion

- tests/test_download_report.py:
  - patch run.BUILD_ID in process_gatling_report write test to avoid random-uuid
    contamination when run after test_start_job
  - patch sleep in does_not_raise test to prevent 120s hang from 12-retry loop

- tests/test_csv_splitter.py: update to match current csv_splitter.py API:
  - csv_files as dict {path: has_header}, correct plural /artifacts/ URL prefix,
    s3_settings kwarg, correct output path /tmp/csv_files/ (not /scv_files/)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…lict

loki-logger 1.1.1 (PyPI) requires requests>=2.31.0, which is irreconcilable
with arbiter==1.0.0 pinning requests==2.25.0. The loki_logger GitHub source
resolves to the same PyPI package, so both spellings trigger the conflict.

Tests never exercise Loki logging (all HTTP is mocked via requests_mock), so
installing the real package in CI is unnecessary. Instead, a sys.modules stub
in tests/conftest.py satisfies the bare `from centry_loki import log_loki`
at the top of run.py before any test file imports it.

Remove the loki_logger line from requirements-dev.txt entirely so pip can
resolve the dependency graph without conflict.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ter repo

BasicEcommerce.jmx was the top-level file when the test was originally
written in May 2021, but was removed during a repo reorganization.
The file that exists today is Dummy.jmx. Also adds a cleanup_git_dir
fixture so /tmp/git_dir is removed before and after the test, preventing
FileExistsError on reruns.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Extends the existing download_report toggle to cover observer/UI
(Lighthouse) job types in addition to perfgun/perfmeter.

- Add download_lighthouse_report(s3_settings, retry=12): lists the
  fixed 'reports' bucket, filters for files ending with
  _user-flow.report.html, takes the last match (most recent), retries
  12x, returns (filename, response) or (None, None) — non-fatal
- Add process_lighthouse_report(args, s3_settings): wrapper that saves
  the HTML report to args.report_path
- Extend _start_and_track(): add elif job_type==observer branch to
  call process_lighthouse_report when download_report=True
- Gate save_reports implicit override to perfgun/perfmeter only;
  observer jobs do not require save_reports=True to upload reports
- Add 10 new tests in tests/test_download_report.py (sections 9-12)
  covering: HTML lookup, last-match selection, retry, write, non-raise,
  routing for observer vs perfgun, and save_reports gating
- Test suite: 25 passed, 4 pre-existing Python 3.14 argparse failures
  (unrelated to this change), 0 regressions

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants