Skip to content

Commit 51b3bbd

Browse files
committed
fix: resolve pr review comments
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
1 parent ed3b111 commit 51b3bbd

4 files changed

Lines changed: 42 additions & 31 deletions

File tree

.github/scripts/public-api-e2e-tests.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
# Database setup/reset is handled externally.
66
#
77
# Required environment variables (same names as GitHub Actions secrets/vars):
8-
# AUTH0_API_E2E_CLIENT_ID
9-
# AUTH0_API_E2E_CLIENT_SECRET
108
# AUTH0_STAGING_AUDIENCE
119
# AUTH0_STAGING_ISSUER
10+
# AUTH0_API_E2E_CLIENT_ID
11+
# AUTH0_API_E2E_CLIENT_SECRET
1212
# CDP_API_E2E_BASE_URL
1313
#
1414
# Do not enable `set -x`; requests include sensitive credentials.

.github/workflows/api-e2e-tests.yml

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,10 @@ concurrency:
99
group: api-e2e-tests
1010
cancel-in-progress: false
1111

12+
permissions:
13+
contents: read
14+
1215
env:
13-
CLOUD_ENV: lf-oracle-staging
14-
ORACLE_DOCKER_USERNAME: ${{ secrets.ORACLE_DOCKER_USERNAME }}
15-
ORACLE_DOCKER_PASSWORD: ${{ secrets.ORACLE_DOCKER_PASSWORD }}
16-
ORACLE_USER: ${{ secrets.ORACLE_USER }}
17-
ORACLE_TENANT: ${{ secrets.ORACLE_TENANT }}
18-
ORACLE_REGION: ${{ secrets.ORACLE_REGION }}
19-
ORACLE_FINGERPRINT: ${{ secrets.ORACLE_FINGERPRINT }}
20-
ORACLE_KEY: ${{ secrets.ORACLE_KEY }}
21-
ORACLE_CLUSTER: ${{ secrets.ORACLE_STAGING_CLUSTER }}
22-
AUTH0_API_E2E_CLIENT_ID: ${{ secrets.AUTH0_API_E2E_CLIENT_ID }}
23-
AUTH0_API_E2E_CLIENT_SECRET: ${{ secrets.AUTH0_API_E2E_CLIENT_SECRET }}
24-
AUTH0_STAGING_AUDIENCE: ${{ vars.AUTH0_STAGING_AUDIENCE }}
25-
AUTH0_STAGING_ISSUER: ${{ vars.AUTH0_STAGING_ISSUER }}
2616
CDP_API_E2E_BASE_URL: ${{ vars.CDP_API_E2E_BASE_URL }}
2717

2818
jobs:
@@ -35,22 +25,39 @@ jobs:
3525
ref: main
3626

3727
- name: Install OCI
28+
env:
29+
OCI_CLI_INSTALL_REF: v3.89.3
30+
OCI_CLI_VERSION: 3.89.3
3831
run: |
39-
curl -L https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.sh > install.sh
32+
set -euo pipefail
33+
curl -fsSL "https://raw.githubusercontent.com/oracle/oci-cli/${OCI_CLI_INSTALL_REF}/scripts/install/install.sh" -o install.sh
4034
chmod +x install.sh
41-
./install.sh --accept-all-defaults
42-
echo "OCI_CLI_DIR=/home/runner/bin" >> $GITHUB_ENV
35+
./install.sh --accept-all-defaults --oci-cli-version "${OCI_CLI_VERSION}"
36+
echo "OCI_CLI_DIR=/home/runner/bin" >> "$GITHUB_ENV"
4337
4438
- name: Update PATH
45-
run: echo "${{ env.OCI_CLI_DIR }}" >> $GITHUB_PATH
39+
run: echo "${{ env.OCI_CLI_DIR }}" >> "$GITHUB_PATH"
4640

47-
- uses: ./.github/actions/node/builder
41+
- name: Deploy api-e2e
42+
uses: ./.github/actions/node/builder
43+
env:
44+
CLOUD_ENV: lf-oracle-staging
45+
ORACLE_DOCKER_USERNAME: ${{ secrets.ORACLE_DOCKER_USERNAME }}
46+
ORACLE_DOCKER_PASSWORD: ${{ secrets.ORACLE_DOCKER_PASSWORD }}
47+
ORACLE_USER: ${{ secrets.ORACLE_USER }}
48+
ORACLE_TENANT: ${{ secrets.ORACLE_TENANT }}
49+
ORACLE_REGION: ${{ secrets.ORACLE_REGION }}
50+
ORACLE_FINGERPRINT: ${{ secrets.ORACLE_FINGERPRINT }}
51+
ORACLE_KEY: ${{ secrets.ORACLE_KEY }}
52+
ORACLE_CLUSTER: ${{ secrets.ORACLE_STAGING_CLUSTER }}
4853
with:
4954
services: api-e2e
5055

5156
- name: Wait for api-e2e
5257
run: |
5358
set -euo pipefail
59+
# Builder only runs kubectl set image; wait for the new revision before health.
60+
kubectl rollout status deployment/api-e2e-dpl --timeout=600s
5461
health_url="${CDP_API_E2E_BASE_URL%/v1}/health"
5562
for i in $(seq 1 36); do
5663
curl -fsS --max-time 10 "$health_url" >/dev/null && exit 0
@@ -60,4 +67,9 @@ jobs:
6067
exit 1
6168
6269
- name: Run Public API e2e tests
70+
env:
71+
AUTH0_STAGING_AUDIENCE: ${{ vars.AUTH0_STAGING_AUDIENCE }}
72+
AUTH0_STAGING_ISSUER: ${{ vars.AUTH0_STAGING_ISSUER }}
73+
AUTH0_API_E2E_CLIENT_ID: ${{ secrets.AUTH0_API_E2E_CLIENT_ID }}
74+
AUTH0_API_E2E_CLIENT_SECRET: ${{ secrets.AUTH0_API_E2E_CLIENT_SECRET }}
6375
run: bash .github/scripts/public-api-e2e-tests.sh

docs/adr/0011-api-e2e-test-architecture.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66

77
## Context
88

9-
We need to catch regressions on the API on `main` sooner (auth, routing, validation, and the sync HTTP response contract) without waiting for a consumer to hit a break. Relying on manually running the script every time is hard and not reliable. It pollutes staging data, depends on ambient fixtures, and does not work as a team habit.
9+
We want to catch API regressions on main sooner (auth, routing, validation, and the synchronous HTTP response contract) instead of waiting for a consumer to hit a problem. Manually running the test script is easy to forget, pollutes staging data, depends on existing fixtures, and is not something we can rely on as a team.
1010

11-
A fuller API e2e harness in the server test setup (PR CI, isolated fixtures, typed asserts) is planned and sits in the backlog. Until that is ready, we need a short-term automated check that is isolated from staging data and cheap to operate.
11+
A more complete API e2e harness in the server test setup (PR CI, isolated fixtures, typed assertions) is planned for future work. Until then, we need a simple automated check that runs against an isolated environment and gives us confidence that the deployed API is still working as expected.
1212

13-
**Focus for now is the Public API.** Those endpoints are consumed outside the product, so we need a minimum unbroken contract there first. Internal API routes are not the priority for these tests; we can add coverage for them later when there is a real need, using the same stack and suite pattern.
13+
The first test suite covers the Public API. These endpoints are the external contract our consumers rely on, so they are the best place to start. We can add more API e2e suites over time using the same runtime and suite pattern as needed.
1414

15-
This ADR is the **runtime and isolation** decision. How e2e test cases are written lives in [ADR-0012](./0012-api-e2e-test-suite-design.md). Current suite: [`.github/scripts/public-api-e2e-tests.sh`](../../.github/scripts/public-api-e2e-tests.sh).
15+
This ADR covers the runtime and isolation architecture for API e2e tests. The design of the test suites themselves is covered in [ADR-0012](./0012-api-e2e-test-suite-design.md). The current suite lives in [`.github/scripts/public-api-e2e-tests.sh`](../../.github/scripts/public-api-e2e-tests.sh).
1616

1717
## Decision
1818

@@ -78,7 +78,7 @@ A single shared `api-e2e` cannot safely gate concurrent PRs, because deploys and
7878

7979
### Database reset (ops)
8080

81-
[`reset_api_e2e_test_db.sh`](../../reset_api_e2e_test_db.sh) runs on the EC2 host used to reach staging Postgres over SSH. It creates `crowd_api_e2e` if needed, applies normal Flyway migrations, truncates tables, and seeds the default tenant.
81+
`reset_api_e2e_test_db.sh` runs on the EC2 host used to reach staging Postgres over SSH. It creates `crowd_api_e2e` if needed, applies normal Flyway migrations, truncates tables, and seeds the default tenant.
8282

8383
Run it after migrations land on `main`, or when leftover e2e test rows should be cleared. Keep that host’s crowd.dev checkout on latest `main` so Flyway matches the deployed `api-e2e`.
8484

docs/adr/0012-api-e2e-test-suite-design.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@
66

77
## Context
88

9-
API e2e tests need a maintainable HTTP suite that can grow as endpoints are added. For now the suite covers the **Public API** (see [ADR-0011](./0011-api-e2e-test-architecture.md)); the same writing pattern should hold if we later add internal API e2e tests when there is a real need.
9+
API e2e tests need a maintainable HTTP suite pattern that can grow as endpoints are added. Without shared structure, suites tend to split by HTTP method, accumulate one-off asserts, and become hard to extend or review.
1010

11-
Without a shared structure, suites tend to split by HTTP method, accumulate one-off asserts, and become hard to extend or review. We want a thin, boring pattern: shared helpers, clear grouping, and an obvious place to add the next resource. This is how we write durable e2e cases until a fuller PR-time API e2e harness exists (backlog).
11+
We want a thin, boring pattern: shared helpers, clear grouping, and an obvious place to add the next resource. This is how we write durable e2e cases until a fuller PR-time API e2e harness exists (backlog).
1212

13-
This ADR is the **suite design** (how tests are written). Runtime, isolation, scheduled CI, and ops live in [ADR-0011](./0011-api-e2e-test-architecture.md).
13+
This ADR is the **suite design** (how tests are written). Runtime, isolation, scheduled CI, which surfaces we cover, and ops live in [ADR-0011](./0011-api-e2e-test-architecture.md).
1414

1515
## Decision
1616

17-
Implement API e2e tests as HTTP bash script(s) with this structure. Current entrypoint: [`.github/scripts/public-api-e2e-tests.sh`](../../.github/scripts/public-api-e2e-tests.sh) (Public API). New surfaces should reuse this pattern (same script or additional scripts), not invent a parallel style.
17+
Implement API e2e tests as HTTP bash script(s) with this structure. Current entrypoint: [`.github/scripts/public-api-e2e-tests.sh`](../../.github/scripts/public-api-e2e-tests.sh). New suites should reuse this pattern (same script or additional scripts), not invent a parallel style.
1818

19-
The suite is **regression-oriented and intentionally thin**: contract and critical flows over HTTP, not a full matrix of edge cases.
19+
The suite is **thin**: assert the HTTP contract and critical flows so regressions show up early. Leave exhaustive edge-case matrices to unit or focused contract tests.
2020

2121
| Layer | Role |
2222
| --- | --- |
@@ -61,7 +61,6 @@ The suite is **regression-oriented and intentionally thin**: contract and critic
6161
- Adding an endpoint is: open (or create) the resource suite, add `api` + `check`, register in `main` if new.
6262
- Reviews focus on cases, not harness inventiveness.
6363
- Soft `check` keeps the run going so one failure does not hide the rest.
64-
- Public API suites land first; internal API can follow the same rules later without a new design debate.
6564

6665
### Negative
6766

0 commit comments

Comments
 (0)