-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
485 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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 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 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,53 @@ | ||
name: tests | ||
run-name: tests, branch:${{ github.ref_name }}, triggered by @${{ github.actor }} | ||
|
||
concurrency: | ||
# Run only for most recent commit in PRs but for all tags and commits on main | ||
# Ref: https://docs.github.com/en/actions/using-jobs/using-concurrency | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.sha }} | ||
cancel-in-progress: true | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- '*' | ||
push: | ||
branches: | ||
- 'main' | ||
schedule: | ||
- cron: '30 2 * * *' | ||
workflow_dispatch: {} | ||
|
||
jobs: | ||
unit-tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: go.mod | ||
|
||
- name: run unit tests | ||
run: make test.unit | ||
|
||
integration-tests: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- konnect-api-url: https://us.api.konghq.tech | ||
- konnect-api-url: https://eu.api.konghq.tech | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: go.mod | ||
|
||
- name: run integration tests | ||
run: make test.integration | ||
env: | ||
KONNECT_API_URL: ${{ matrix.konnect-api-url }} | ||
KONNECT_API_PAT: ${{ secrets.KONNECT_API_PAT }} |
This file contains 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 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 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 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 |
---|---|---|
@@ -1,4 +1,14 @@ | ||
github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= | ||
github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= | ||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= | ||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||
github.com/ericlagergren/decimal v0.0.0-20221120152707-495c53812d05 h1:S92OBrGuLLZsyM5ybUzgc/mPjIYk2AZqufieooe98uw= | ||
github.com/ericlagergren/decimal v0.0.0-20221120152707-495c53812d05/go.mod h1:M9R1FoZ3y//hwwnJtO51ypFGwm8ZfpxPT/ZLtO1mcgQ= | ||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= | ||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= | ||
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= | ||
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= | ||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= | ||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= | ||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= |
This file contains 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,174 @@ | ||
package hooks | ||
|
||
import ( | ||
"net/http" | ||
"strings" | ||
) | ||
|
||
type GlobalAPIURLRequestHook struct{} | ||
|
||
var _ beforeRequestHook = (*GlobalAPIURLRequestHook)(nil) | ||
|
||
func (i *GlobalAPIURLRequestHook) BeforeRequest(hookCtx BeforeRequestContext, req *http.Request) (*http.Request, error) { | ||
// NOTE: the list below was generated with | ||
// for op in $(rg --no-line-number -o "operationId: (.*)" -r '$1' ../platform-api/src/konnect/definitions/identity/v3/openapi.yaml); do printf "case \"$op\":\n\tfallthrough\n"; done | ||
switch hookCtx.OperationID { | ||
case "post-auth0-register-internal": | ||
fallthrough | ||
case "get-auth0-organizations-internal": | ||
fallthrough | ||
case "get-users-internal": | ||
fallthrough | ||
case "post-oauth-device-authorize": | ||
fallthrough | ||
case "post-oauth-device-token": | ||
fallthrough | ||
case "post-oauth-device-authorize-user": | ||
fallthrough | ||
case "patch-oauth-device-confirm": | ||
fallthrough | ||
case "get-impersonation-settings": | ||
fallthrough | ||
case "update-impersonation-settings": | ||
fallthrough | ||
case "get-authentication-settings": | ||
fallthrough | ||
case "update-authentication-settings": | ||
fallthrough | ||
case "invite-user": | ||
fallthrough | ||
case "get-identity-providers": | ||
fallthrough | ||
case "create-identity-provider": | ||
fallthrough | ||
case "get-identity-provider": | ||
fallthrough | ||
case "update-identity-provider": | ||
fallthrough | ||
case "delete-identity-provider": | ||
fallthrough | ||
case "get-idp-configuration": | ||
fallthrough | ||
case "update-idp-configuration": | ||
fallthrough | ||
case "update-idp-team-mappings": | ||
fallthrough | ||
case "get-idp-team-mappings": | ||
fallthrough | ||
case "get-team-group-mappings": | ||
fallthrough | ||
case "patch-team-group-mappings": | ||
fallthrough | ||
case "get-predefined-roles": | ||
fallthrough | ||
case "list-teams": | ||
fallthrough | ||
case "create-team": | ||
fallthrough | ||
case "list-team-users": | ||
fallthrough | ||
case "add-user-to-team": | ||
fallthrough | ||
case "get-team": | ||
fallthrough | ||
case "update-team": | ||
fallthrough | ||
case "delete-team": | ||
fallthrough | ||
case "remove-user-from-team": | ||
fallthrough | ||
case "list-team-roles": | ||
fallthrough | ||
case "teams-assign-role": | ||
fallthrough | ||
case "teams-remove-role": | ||
fallthrough | ||
case "list-users": | ||
fallthrough | ||
case "get-user": | ||
fallthrough | ||
case "update-user": | ||
fallthrough | ||
case "delete-user": | ||
fallthrough | ||
case "list-user-teams": | ||
fallthrough | ||
case "list-user-roles": | ||
fallthrough | ||
case "users-assign-role": | ||
fallthrough | ||
case "users-remove-role": | ||
fallthrough | ||
case "get-system-accounts": | ||
fallthrough | ||
case "post-system-accounts": | ||
fallthrough | ||
case "get-system-accounts-id": | ||
fallthrough | ||
case "patch-system-accounts-id": | ||
fallthrough | ||
case "delete-system-accounts-id": | ||
fallthrough | ||
case "get-system-account-id-access-tokens": | ||
fallthrough | ||
case "post-system-accounts-id-access-tokens": | ||
fallthrough | ||
case "get-system-accounts-id-access-tokens-id": | ||
fallthrough | ||
case "patch-system-accounts-id-access-tokens-id": | ||
fallthrough | ||
case "delete-system-accounts-id-access-tokens-id": | ||
fallthrough | ||
case "get-system-accounts-assigned-roles-internal": | ||
fallthrough | ||
case "create-system-accounts-assigned-roles-internal": | ||
fallthrough | ||
case "get-system-accounts-accountId-assigned-roles": | ||
fallthrough | ||
case "post-system-accounts-accountId-assigned-roles": | ||
fallthrough | ||
case "delete-system-accounts-accountId-assigned-roles-roleId": | ||
fallthrough | ||
case "get-teams-teamId-system-accounts": | ||
fallthrough | ||
case "post-teams-teamId-system-accounts": | ||
fallthrough | ||
case "delete-teams-teamId-system-accounts-accountId": | ||
fallthrough | ||
case "get-system-accounts-accountId-teams": | ||
fallthrough | ||
case "get-users-me": | ||
fallthrough | ||
case "delete-users-me": | ||
fallthrough | ||
case "patch-users-me": | ||
fallthrough | ||
case "get-users-me-permissions": | ||
fallthrough | ||
case "get-organizations-me": | ||
fallthrough | ||
case "update-organizations-me": | ||
fallthrough | ||
case "refresh-token": | ||
fallthrough | ||
case "logout": | ||
fallthrough | ||
case "resolveCustomer": | ||
fallthrough | ||
case "authenticate-sso": | ||
// NOTE(pmalek): This is because we merge OpenAPI specs and /organizations/me | ||
// is only served by the global API. | ||
// @mheap mentioned that we can add operation specific URLs to do away with this. | ||
if strings.HasSuffix(req.URL.Host, "api.konghq.tech") { | ||
req.URL.Host = "global.api.konghq.tech" | ||
req.Host = "global.api.konghq.tech" | ||
} else { | ||
req.URL.Host = "global.api.konghq.com" | ||
req.Host = "global.api.konghq.com" | ||
} | ||
|
||
default: | ||
|
||
} | ||
return req, nil | ||
} |
This file contains 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
Oops, something went wrong.