-
Notifications
You must be signed in to change notification settings - Fork 14
Add live-UAA end-to-end integration test suite #333
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
7c361ef
Add live-UAA end-to-end integration test suite
duanemay 0ef3456
Exclude integration/ from the regular ginkgo -r test run
duanemay d6550f6
Address Copilot review feedback on the integration test suite
duanemay 5ed450a
Split integration suite by resource area; fix a real refresh-token bug
duanemay aff8dac
Add test-all target; stop tracking go-uaa-coverage-gaps.md
duanemay 9b64e50
Address second round of Copilot review feedback on PR #333
duanemay 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,75 @@ | ||
| name: UAA integration test | ||
|
|
||
| # Exercises the compiled uaa-cli binary against a real UAA server (not a | ||
| # mocked HTTP server) so that response-shape bugs -- e.g. go-uaa failing to | ||
| # unmarshal a field UAA legitimately serializes as more than one JSON type -- | ||
| # are caught before merge instead of by a user in production. | ||
| # | ||
| # Known gaps (not covered here): get-authcode-token and get-implicit-token | ||
| # need a real browser + local OAuth redirect callback, which isn't reliably | ||
| # scriptable headlessly. Zone-scoped (-z/--zone) command variants are also | ||
| # not exercised. | ||
| # | ||
| # Currently disabled (integration/clients_test.go): the spec that actually | ||
| # reproduces the original list-clients/allowpublic regression is marked | ||
| # PIt, because it will fail until cloudfoundry-community/go-uaa#175 is | ||
| # released and go.mod is bumped to it -- there's no released go-uaa version | ||
| # with the fix yet. Un-pend it once that lands; until then, this workflow | ||
| # exercises everything else but not that specific regression. | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ "master" ] | ||
| pull_request: | ||
| branches: [ "master" ] | ||
| schedule: | ||
| - cron: '20 7 * * *' | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| uaa-integration-test: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout uaa-cli | ||
| uses: actions/checkout@v7 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Checkout cloudfoundry/uaa | ||
| uses: actions/checkout@v7 | ||
| with: | ||
| repository: cloudfoundry/uaa | ||
| ref: develop | ||
| path: uaa | ||
| persist-credentials: false | ||
|
|
||
| - uses: actions/setup-java@v5 | ||
| with: | ||
| distribution: temurin | ||
| java-version: '25' | ||
|
|
||
| - name: Cache Gradle | ||
| uses: actions/cache@v6 | ||
| with: | ||
| path: | | ||
| ~/.gradle/caches | ||
| ~/.gradle/wrapper | ||
| key: gradle-${{ runner.os }}-${{ hashFiles('uaa/**/*.gradle*', 'uaa/gradle/wrapper/gradle-wrapper.properties') }} | ||
|
|
||
| - name: Start UAA | ||
| run: scripts/start-uaa.sh uaa | ||
|
|
||
| - uses: actions/setup-go@v7 | ||
| with: | ||
| go-version-file: go.mod | ||
| check-latest: true | ||
|
|
||
| - name: Run live UAA integration suite | ||
| run: make test-integration | ||
|
|
||
| - name: Dump UAA boot log on failure | ||
| if: failure() | ||
| run: cat uaa-boot.log || true | ||
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 |
|---|---|---|
|
|
@@ -5,3 +5,5 @@ uaa-cli | |
| uaa | ||
| build/ | ||
| dist/ | ||
| uaa-boot.log | ||
| uaa-boot.pid | ||
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,25 @@ | ||
| //go:build integration | ||
|
|
||
| package integration | ||
|
|
||
| import ( | ||
| . "github.com/onsi/ginkgo/v2" | ||
| ) | ||
|
|
||
| var _ = Describe("cli basics", func() { | ||
| It("shows server info", func() { | ||
| assertValidJSON(runOK("info")) | ||
| }) | ||
|
|
||
| It("shows the current context", func() { | ||
| runOK("context") | ||
| }) | ||
|
|
||
| It("lists saved contexts", func() { | ||
| runOK("contexts") | ||
| }) | ||
|
|
||
| It("prints the version", func() { | ||
| runOK("version") | ||
| }) | ||
| }) |
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,64 @@ | ||
| //go:build integration | ||
|
|
||
| package integration | ||
|
|
||
| import ( | ||
| . "github.com/onsi/ginkgo/v2" | ||
| . "github.com/onsi/gomega" | ||
| ) | ||
|
|
||
| var _ = Describe("clients", Ordered, func() { | ||
| clientID := "uaa-cli-integration-test-client" | ||
|
|
||
| AfterAll(func() { | ||
| // Other Describes assume an admin token is active; assert this one. | ||
| runOK("get-client-credentials-token", "admin", "-s", "adminsecret") | ||
| run("delete-client", clientID) | ||
| }) | ||
|
|
||
| PIt("lists clients, including the legacy string-typed additionalInformation clients seeded by scripts/boot/uaa.yml", func() { | ||
| // login, client_federated_jwt_trust, client_with_allowpublic_and_jwks_uri_trust, | ||
| // and oauth_showcase_saml2_bearer are all seeded with allowpublic/autoapprove as | ||
| // YAML strings, which UAA stores verbatim and serializes back as JSON strings | ||
| // rather than booleans -- the exact shape that broke `uaa list-clients` originally. | ||
|
Comment on lines
+19
to
+23
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. chagne to It after update to new fixed go-uaa |
||
| // Un-pend once cloudfoundry-community/go-uaa#175 is released and go.mod is bumped. | ||
| session := runOK("list-clients") | ||
| assertValidJSON(session) | ||
| Expect(string(session.Out.Contents())).To(ContainSubstring("client_federated_jwt_trust")) | ||
| }) | ||
|
|
||
| It("gets one of the legacy string-typed clients directly", func() { | ||
| // client_federated_jwt_trust has no allowpublic key at all, so unlike | ||
| // list-clients above this doesn't hit the go-uaa bug -- it's here to | ||
| // confirm get-client for other legacy clients still works today. | ||
| assertValidJSON(runOK("get-client", "client_federated_jwt_trust")) | ||
| }) | ||
|
|
||
| It("creates a client", func() { | ||
| runOK("create-client", clientID, | ||
| "-s", "test-secret", | ||
| "--authorized_grant_types", "client_credentials,refresh_token", | ||
| "--scope", "uaa.none", | ||
| // clients.secret is required for a client to change its own secret | ||
| // via change-client-secret below. | ||
| "--authorities", "uaa.none,clients.secret", | ||
| ) | ||
| }) | ||
|
|
||
| It("gets the new client", func() { | ||
| assertValidJSON(runOK("get-client", clientID)) | ||
| }) | ||
|
|
||
| It("updates the client", func() { | ||
| runOK("update-client", clientID, "--scope", "uaa.none,openid") | ||
| }) | ||
|
|
||
| It("sets the client secret", func() { | ||
| runOK("set-client-secret", clientID, "-s", "second-test-secret") | ||
| }) | ||
|
|
||
| It("gets a token as the client and changes its own secret", func() { | ||
| runOK("get-client-credentials-token", clientID, "-s", "second-test-secret") | ||
| runOK("change-client-secret", "--old_secret", "second-test-secret", "--secret", "third-test-secret") | ||
| }) | ||
| }) | ||
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,52 @@ | ||
| //go:build integration | ||
|
|
||
| package integration | ||
|
|
||
| import ( | ||
| . "github.com/onsi/ginkgo/v2" | ||
| ) | ||
|
|
||
| var _ = Describe("groups", Ordered, func() { | ||
| groupName := "uaa.cli.integration.test.group" | ||
| memberUsername := "uaa-cli-integration-test-group-member" | ||
|
|
||
| BeforeAll(func() { | ||
| runOK("create-user", memberUsername, | ||
| "--givenName", "Group", "--familyName", "Member", | ||
| "--email", memberUsername+"@example.com", "-p", "S0meSecur3Pass!", | ||
| ) | ||
| }) | ||
|
|
||
| AfterAll(func() { | ||
| run("delete-user", memberUsername) | ||
| // uaa-cli has no delete-group command yet, so clean up via the raw | ||
| // SCIM endpoint to avoid a name collision if this suite runs again | ||
| // against the same (non-freshly-booted) UAA instance. | ||
| if id := groupID(groupName); id != "" { | ||
| run("curl", "-X", "DELETE", "/Groups/"+id) | ||
| } | ||
| }) | ||
|
|
||
| It("creates a group", func() { | ||
| runOK("create-group", groupName, "-d", "uaa-cli integration test group") | ||
| }) | ||
|
|
||
| It("gets the group", func() { | ||
| assertValidJSON(runOK("get-group", groupName)) | ||
| }) | ||
|
|
||
| It("lists groups", func() { | ||
| assertValidJSON(runOK("list-groups")) | ||
| }) | ||
|
|
||
| It("adds and removes a member", func() { | ||
| runOK("add-member", groupName, memberUsername) | ||
| runOK("remove-member", groupName, memberUsername) | ||
| }) | ||
|
|
||
| It("maps and unmaps an external group", func() { | ||
| runOK("map-group", "cn=integration-test,ou=groups,dc=example,dc=com", groupName) | ||
| assertValidJSON(runOK("list-group-mappings")) | ||
| runOK("unmap-group", "cn=integration-test,ou=groups,dc=example,dc=com", groupName) | ||
| }) | ||
| }) |
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,19 @@ | ||
| //go:build integration | ||
|
|
||
| package integration | ||
|
|
||
| import ( | ||
| . "github.com/onsi/ginkgo/v2" | ||
| ) | ||
|
|
||
| var _ = Describe("misc", func() { | ||
| It("curls an arbitrary endpoint", func() { | ||
| assertValidJSON(runOK("curl", "/info")) | ||
| }) | ||
|
|
||
| It("gets userinfo for a user-context token", func() { | ||
| runOK("get-password-token", "cf", "-s", "", "-u", "marissa", "-p", "koala") | ||
| assertValidJSON(runOK("userinfo")) | ||
| runOK("get-client-credentials-token", "admin", "-s", "adminsecret") | ||
| }) | ||
| }) |
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.