Skip to content

Commit 2e5bcbd

Browse files
Merge pull request #1437 from gooddata/snapshot-master-4dc3f871-to-rel/dev
[bot] Merge master/4dc3f871 into rel/dev
2 parents 05877f5 + 4dc3f87 commit 2e5bcbd

File tree

316 files changed

+13038
-49454
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

316 files changed

+13038
-49454
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
name: no-parent-chains
3+
description: User dislikes chained .parent.parent.parent path navigation - considers it bad practice
4+
type: feedback
5+
---
6+
7+
Avoid chaining `.parent.parent.parent` for path resolution — it's fragile and hard to read.
8+
9+
**Why:** The user called it "really stupid" and "bad practice." It's brittle when directory structure changes.
10+
11+
**How to apply:** Use explicit path construction, environment variables, or package-relative resource loading instead of long `.parent` chains.
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Staging tests
2+
3+
on:
4+
pull_request:
5+
types: [labeled]
6+
branches:
7+
- master
8+
- 'rel/**'
9+
issue_comment:
10+
types: [created]
11+
workflow_dispatch:
12+
inputs:
13+
test_envs:
14+
description: 'Tox test environments to run (e.g. py312)'
15+
required: false
16+
default: 'py314'
17+
test_filter:
18+
description: 'Pytest filter expression (-k flag)'
19+
required: false
20+
default: ''
21+
22+
concurrency:
23+
group: staging-tests
24+
cancel-in-progress: false
25+
26+
jobs:
27+
staging-tests:
28+
name: Staging tests
29+
if: >-
30+
github.event_name == 'workflow_dispatch' ||
31+
(github.event_name == 'pull_request' && github.event.label.name == 'test-staging') ||
32+
(github.event_name == 'issue_comment' && github.event.issue.pull_request && contains(github.event.comment.body, '/test-staging'))
33+
runs-on:
34+
group: infra1-runners-arc
35+
labels: runners-small
36+
steps:
37+
- name: Get PR head SHA (comment trigger)
38+
if: github.event_name == 'issue_comment'
39+
id: pr
40+
run: |
41+
PR_DATA=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.issue.number }})
42+
echo "sha=$(echo "$PR_DATA" | jq -r .head.sha)" >> "$GITHUB_OUTPUT"
43+
echo "ref=$(echo "$PR_DATA" | jq -r .head.ref)" >> "$GITHUB_OUTPUT"
44+
env:
45+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
47+
- name: Checkout
48+
uses: actions/checkout@v4
49+
with:
50+
ref: ${{ steps.pr.outputs.sha || github.event.pull_request.head.sha || github.sha }}
51+
52+
- name: Set up Python
53+
uses: astral-sh/setup-uv@v6
54+
with:
55+
python-version: '3.14'
56+
57+
- name: Install dependencies
58+
run: uv sync --group test --locked
59+
60+
- name: Clean staging environment
61+
run: make clean-staging
62+
env:
63+
TOKEN: ${{ secrets.PYTHON_SDK_STG_API_KEY }}
64+
65+
- name: Load staging environment
66+
run: make load-staging
67+
env:
68+
TOKEN: ${{ secrets.PYTHON_SDK_STG_API_KEY }}
69+
70+
- name: Run staging tests
71+
run: |
72+
make test-staging \
73+
TEST_ENVS=${{ github.event.inputs.test_envs || 'py314' }} \
74+
ADD_ARGS="${{ github.event.inputs.test_filter && format('-k {0}', github.event.inputs.test_filter) || '' }}"
75+
env:
76+
TOKEN: ${{ secrets.PYTHON_SDK_STG_API_KEY }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,6 @@ docs/.hugo_build.lock
3434

3535
# Export artifacts from Docker export-controller service
3636
packages/gooddata-sdk/tests/export/exports/default/
37+
38+
# Staging test fixture backups (created by conftest.py, self-heal on next run)
39+
*.staging-backup

CONTRIBUTING.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,42 @@ docker compose --profile fdw up -d
292292
293293
This starts a PostgreSQL instance with the gooddata-fdw extension on port 2543.
294294
295+
## Run staging tests
296+
297+
Staging tests run against a shared GoodData staging environment instead of a local docker-compose stack.
298+
They are useful for validating changes against a real deployment.
299+
300+
### Triggers
301+
302+
The staging tests workflow (`.github/workflows/staging-tests.yaml`) can be triggered in three ways:
303+
304+
1. **Label** — Add the `test-staging` label to a PR targeting `master` or `rel/**`.
305+
2. **PR comment** — Post `/test-staging` as a comment on a PR.
306+
3. **Manual dispatch** — Trigger from the Actions tab with optional `test_envs` and `test_filter` inputs.
307+
308+
Only one staging test run executes at a time (concurrency group `staging-tests`, non-cancelling).
309+
310+
### Running staging tests locally
311+
312+
You need a staging API token (`TOKEN`). The workflow uses the `PYTHON_SDK_STG_API_KEY` secret; locally you
313+
pass it via the `TOKEN=` make argument:
314+
315+
```bash
316+
# 1. Clean the staging workspace (removes previous test data)
317+
make clean-staging TOKEN=<your-staging-token>
318+
319+
# 2. Load the demo layout into staging
320+
make load-staging TOKEN=<your-staging-token>
321+
322+
# 3. Run the tests
323+
make test-staging TOKEN=<your-staging-token>
324+
325+
# Optionally limit python version and test filter:
326+
make test-staging TOKEN=<your-staging-token> TEST_ENVS=py312 ADD_ARGS="-k test_catalog"
327+
```
328+
329+
The token is passed as a CLI argument (`--gd-test-token`) to pytest, **not** as an environment variable.
330+
295331
## Run continuous integration tests
296332
Tests in pull request (PR) are executed using docker. The following is done to make test environment as close
297333
to reproducible as possible:

Makefile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,21 @@ test:
8888
for project in $(NO_CLIENT_GD_PROJECTS_DIRS); do $(MAKE) -C packages/$${project} test || RESULT=$$?; done; \
8989
exit $$RESULT
9090

91+
.PHONY: test-staging
92+
test-staging:
93+
@test -n "$(TOKEN)" || (echo "ERROR: TOKEN is required. Usage: make test-staging TOKEN=<api-token>" && exit 1)
94+
$(MAKE) -C packages/gooddata-sdk test-staging TOKEN=$(TOKEN)
95+
96+
.PHONY: clean-staging
97+
clean-staging:
98+
@test -n "$(TOKEN)" || (echo "ERROR: TOKEN is required. Usage: make clean-staging TOKEN=<api-token>" && exit 1)
99+
cd packages/tests-support && STAGING=1 TOKEN="$(TOKEN)" python clean_staging.py
100+
101+
.PHONY: load-staging
102+
load-staging:
103+
@test -n "$(TOKEN)" || (echo "ERROR: TOKEN is required. Usage: make load-staging TOKEN=<api-token>" && exit 1)
104+
cd packages/tests-support && STAGING=1 TOKEN="$(TOKEN)" python upload_demo_layout.py
105+
91106
.PHONY: release
92107
release:
93108
if [ -z "$(VERSION)" ]; then echo "Usage: 'make release VERSION=X.Y.Z'"; false; else \

docker-compose.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,8 @@ services:
504504
GRPC_METADATA_PORT: 6572
505505
GRPC_MDSINK_HOST: gateway-md-sink
506506
GRPC_MDSINK_PORT: 6574
507+
GRPC_FORGE_HOST: gateway-md-sink
508+
GRPC_FORGE_PORT: 6574
507509
GATEWAY_ORGANIZATION_RESOLVER_TYPE: GRPC_WITH_DB_VALIDATION
508510
GATEWAY_R2DBC_URL: 'r2dbc:postgresql://postgres:5432/gw?reWriteBatchedInserts=true'
509511
GATEWAY_DB_USERNAME: postgres
@@ -1064,6 +1066,7 @@ services:
10641066
FIXTURES_DIR: "/app/fixtures"
10651067
volumes:
10661068
- ./packages/tests-support/fixtures:/app/fixtures:ro
1069+
- ./packages/gooddata-sdk/tests/gd_test_config.yaml:/app/gd_test_config.yaml:ro
10671070
- ./packages/tests-support/upload_demo_layout.py:/app/upload_demo_layout.py:ro
10681071
entrypoint: ["/bin/sh", "-c"]
10691072
command:

0 commit comments

Comments
 (0)