Repository navigation
test(oauth): check OAuth scopes against a live server #1128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| name: OAuth Scopes | ||
|
|
||
| # PRs use the release pinned in compose.yaml; nightly runs use the latest | ||
| # preview to catch server changes before they ship. | ||
| on: | ||
| pull_request: | ||
| # Code the probes run or import | ||
| paths: | ||
| - src/** | ||
| - test/mocks/** | ||
| - test/scopes/** | ||
| - package.json | ||
| - pnpm-lock.yaml | ||
| - vitest.config.mts | ||
| - .github/workflows/oauth-scopes.yaml | ||
| schedule: | ||
| # Off the hour, when GitHub delays or drops fewer scheduled runs | ||
| - cron: "17 6 * * *" | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| live-server: | ||
| name: Live Server Test (coder-preview) | ||
| runs-on: ubuntu-24.04 | ||
| timeout-minutes: 15 | ||
| permissions: | ||
| contents: read | ||
| issues: write | ||
| steps: | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| persist-credentials: false | ||
| - uses: ./.github/actions/setup | ||
| - run: docker compose -f test/scopes/compose.yaml up -d --wait | ||
| env: | ||
| CODER_IMAGE: ${{ github.event_name == 'schedule' && 'ghcr.io/coder/coder-preview:latest' || '' }} | ||
| - run: pnpm test:scopes | ||
| env: | ||
| CODER_SCOPES_TEST_URL: http://localhost:7080 | ||
| # A failed scheduled run notifies only one person, so track it in an issue. | ||
| - name: Report nightly failure | ||
| if: failure() && github.event_name == 'schedule' | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| GH_REPO: ${{ github.repository }} | ||
| RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
| run: | | ||
| title="Nightly OAuth scope test failed" | ||
| issue=$(gh issue list --state open --search "\"$title\" in:title" --json number --jq '.[0].number') | ||
| if [ -n "$issue" ]; then | ||
| gh issue comment "$issue" --body "Failed again: $RUN_URL" | ||
| else | ||
| gh issue create --title "$title" --body "The scope test failed against \`coder-preview:latest\`: $RUN_URL" | ||
| fi | ||
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| # A throwaway deployment for `pnpm test:scopes`; see docs/TESTING.md. | ||
| services: | ||
| postgres: | ||
| image: postgres:17 | ||
| environment: | ||
| POSTGRES_USER: coder | ||
| POSTGRES_PASSWORD: coder | ||
| POSTGRES_DB: coder | ||
| healthcheck: | ||
| test: pg_isready -U coder | ||
| interval: 2s | ||
| retries: 30 | ||
|
|
||
| coder: | ||
| image: ${CODER_IMAGE:-ghcr.io/coder/coder:v2.38.0@sha256:38a4cfc548b096484d6d1743e5f1a5af18301ed9a7ffde5150663822f9887026} | ||
| ports: ["127.0.0.1:7080:7080"] | ||
| environment: | ||
| CODER_PG_CONNECTION_URL: postgres://coder:coder@postgres:5432/coder?sslmode=disable | ||
| CODER_HTTP_ADDRESS: 0.0.0.0:7080 | ||
| CODER_ACCESS_URL: http://localhost:7080 | ||
| CODER_OAUTH2_PROVIDER_ENABLE: "true" | ||
| depends_on: | ||
| postgres: | ||
| condition: service_healthy | ||
| healthcheck: | ||
| test: curl -fs http://localhost:7080/healthz | ||
| interval: 2s | ||
| retries: 60 |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.