feat(tests): overhaul staging test infrastructure and update fixtures#1392
Open
feat(tests): overhaul staging test infrastructure and update fixtures#1392
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
hkad98
reviewed
Mar 5, 2026
.github/workflows/staging-tests.yaml
Outdated
| test_envs: | ||
| description: 'Tox test environments to run (e.g. py312)' | ||
| required: false | ||
| default: 'py312' |
Contributor
There was a problem hiding this comment.
Use the default (py314), please.
hkad98
reviewed
Mar 5, 2026
.github/workflows/staging-tests.yaml
Outdated
| - name: Set up Python | ||
| uses: astral-sh/setup-uv@v6 | ||
| with: | ||
| python-version: '3.12' |
hkad98
reviewed
Mar 5, 2026
.github/workflows/staging-tests.yaml
Outdated
Comment on lines
+60
to
+61
| - name: Clean staging environment | ||
| run: make clean-staging TOKEN=${{ secrets.PYTHON_SDK_STG_API_KEY }} |
Contributor
There was a problem hiding this comment.
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.
- 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
This commit was tested and passes both local tests, and also current staging environment.
JIRA: DX-431
risk: low