Skip to content

feat(tests): overhaul staging test infrastructure and update fixtures#1392

Open
tychtjan wants to merge 3 commits intomasterfrom
tests_rewrite_staging
Open

feat(tests): overhaul staging test infrastructure and update fixtures#1392
tychtjan wants to merge 3 commits intomasterfrom
tests_rewrite_staging

Conversation

@tychtjan
Copy link
Contributor

@tychtjan tychtjan commented Mar 5, 2026

TLDR: Added way to test on staging (PYTHON_DEX), which resulted in some rewrites in the tests themselves (dynamic replace of postgresql urls, to not copy fixture files and just replacing it), and lastly added workflow for future premerge tests.

  • Rewrite test infrastructure for staging environment safety
  • Update OpenAPI-generated API client with new models and endpoints.
  • Regenerate gooddata-sdk test cassettes against staging.
  • Remove obsolete cassettes from gooddata-pandas, gooddata-fdw, and gooddata-sdk packages.
  • Add staging-tests.yaml workflow triggered by label, PR comment (/test-staging), or manual dispatch
  • Unify token passing: all staging make targets now use TOKEN= argument
  • Document staging test workflow in CONTRIBUTING.md

This commit was tested and passes both local tests, and also current staging environment.

JIRA: DX-431
risk: low

Rewrite test infrastructure for staging environment safety.
Update OpenAPI-generated API client with new models and endpoints.
Regenerate gooddata-sdk test cassettes against staging.
Remove obsolete cassettes from gooddata-pandas, gooddata-fdw, and
gooddata-sdk packages.

- Add staging-tests.yaml workflow triggered by label, PR comment (/test-staging), or manual dispatch
- Concurrency blocking ensures only one staging test runs at a time
- Unify token passing: all staging make targets now use TOKEN= argument
- Replace GD_STAGING_TOKEN env var with --gd-test-token pytest CLI argument
- Remove TOKEN from tox pass_env (no longer needed as env var)
- Document staging test workflow in CONTRIBUTING.md

JIRA: DX-431
risk: low
@codecov
Copy link

codecov bot commented Mar 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.53%. Comparing base (9659a3e) to head (cff7d37).
⚠️ Report is 10 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1392      +/-   ##
==========================================
- Coverage   77.53%   77.53%   -0.01%     
==========================================
  Files         225      225              
  Lines       14615    14614       -1     
==========================================
- Hits        11332    11331       -1     
  Misses       3283     3283              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

test_envs:
description: 'Tox test environments to run (e.g. py312)'
required: false
default: 'py312'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the default (py314), please.

- name: Set up Python
uses: astral-sh/setup-uv@v6
with:
python-version: '3.12'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3.14 please

Comment on lines +60 to +61
- name: Clean staging environment
run: make clean-staging TOKEN=${{ secrets.PYTHON_SDK_STG_API_KEY }}
Copy link
Contributor

@hkad98 hkad98 Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- name: Clean staging environment
run: make clean-staging TOKEN=${{ secrets.PYTHON_SDK_STG_API_KEY }}
- name: Clean staging environment
run: make clean-staging
env:
TOKEN: ${{ secrets.PYTHON_SDK_STG_API_KEY }}

Either use secrets in env or with.

tychtjan added 2 commits March 6, 2026 09:32
- Add staging-tests.yaml workflow (trigger: label, /test-staging comment, manual dispatch)
- Concurrency group ensures only one staging test run at a time
- Unified TOKEN passing: all staging make targets accept TOKEN= argument
- Token passed as env var (not CLI arg) to avoid leaking in ps aux
- Fail-fast guard on all targets if TOKEN is missing or empty
- Crash-safe fixture patching: on-disk .staging-backup files self-heal on next run
- .staging-backup files added to .gitignore
- Replaced GD_STAGING_TOKEN with TOKEN env var for consistency across clean/load/test
The snapshot_data_sources fixture captures clean server state before
each test and restores it after, which was overwriting the
alternativeDataSourceId that the test finally blocks set from the
expected JSON. Adding it to the layout upload fixture ensures it's
present from the start and survives snapshot restore.
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