Repository navigation
Conversation
|
Why is this no longer working? Should we not fix the creation? What about the test user we need for the smoke test? |
Do we still use it in any automation? |
|
Looks like you are right, I don't thinkg we use it any longer. I take a look at the pr after the standup 👍 |
OliverTrautvetter
left a comment
There was a problem hiding this comment.
The cleaning looks good to me, two small things. Already approved
| package gcp | ||
|
|
||
| import ( | ||
| "context" |
There was a problem hiding this comment.
Removing the test looks good, but do we still have a test for Bootstrap() ending cleanly without the flag?
|
|
||
| import ( | ||
| "context" | ||
| "errors" |
There was a problem hiding this comment.
I tried it locally, you can use go mod tidy to remove something
Signed-off-by: NautiluX <2600004+NautiluX@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
Timeout cleanup can leave temporary sessions authenticated, while existing jumpboxes may retain an incompatible remote binary that prevents test-user credential creation.
2 open issues
What changed in this PR
Replaces direct PostgreSQL writes for test-user provisioning with the internal Codesphere auth API, letting the application manage password hashing, account initialization, and authorization.
Changes:
- Adds Kubernetes port-forwarding, signup/sign-in, API-token creation, and temporary-session cleanup.
- Runs bootstrap provisioning on the jumpbox and downloads credentials for local storage.
- Updates CLI flags, documentation, and tests; removes database-specific helpers.
| File | Description |
|---|---|
| internal/testuser/testuser.go | Implements API provisioning and private credential persistence. |
| internal/testuser/testuser_test.go | Tests API flow, errors, credentials, and port resolution. |
| internal/testuser/testuser_suite_test.go | Removes the obsolete Ginkgo suite entry point. |
| internal/testuser/portforward.go | Adds loopback-only Kubernetes port-forwarding. |
| internal/testuser/hash.go | Removes local API-token hashing. |
| internal/testuser/hash_test.go | Removes obsolete hashing tests. |
| internal/bootstrap/gcp/test_user.go | Creates users remotely and downloads credentials. |
| internal/bootstrap/gcp/test_user_test.go | Tests jumpbox execution and credential download. |
| internal/bootstrap/gcp/gcp.go | Removes database-based test-user provisioning. |
| go.mod | Reclassifies PostgreSQL dependencies as indirect. |
| docs/oms_create.md | Updates the create-command description. |
| docs/oms_create_test-user.md | Documents API prerequisites and replacement flags. |
| docs/oms_beta_bootstrap-gcp.md | Updates test-user bootstrap flag help. |
| cli/cmd/create.go | Updates parent-command help. |
| cli/cmd/create_test_user.go | Adds Kubernetes configuration, timeout, and API provisioning. |
| cli/cmd/create_test_user_test.go | Verifies replacement flags and removed options. |
| cli/cmd/bootstrap_gcp.go | Describes jumpbox-based API provisioning in flag help. |
Review effort: Balanced
| command := fmt.Sprintf("OMS_WORKDIR=%s oms create test-user --vault %s --vault-priv-key %s", | ||
| shellQuote(remoteWorkdir), shellQuote(dc.RemoteVaultPath()), shellQuote(dc.RemoteAgeKeyPath())) |
| defer func() { | ||
| req, err := http.NewRequestWithContext(ctx, http.MethodPost, address+"/session/v1/sign-out", nil) |

The test-user command writes credentials, team membership and API tokens directly into PostgreSQL. Those writes depend on application schemas and bypass the application’s current password hashing and authorization setup. Replace them with the normal internal auth-service API flow.
oms create test-userandoms beta bootstrap-gcp --create-test-user.KUBECONFIG) or a kubeconfig from a SOPS vault, and supports namespace/service/port overrides.Auth.signUp,Auth.signIn,/session/v1/gen-access-token, then authenticatedApiTokenService.createToken; close the temporary login session afterwards. Normal signup owns account initialization and default-team creation.--emailandOMS_CS_TEST_USER_PASSWORDoverrides for the standalone command. Store credentials inOMS_WORKDIR/test-user.jsonwith mode0600.Requires a test installation with email signup/sign-in enabled, reCAPTCHA disabled, and email confirmation disabled. The signup allowlist and normal API rules still apply. Kubernetes permissions are needed to get services, list pods and create pods/portforward.
Compatibility: remove the PostgreSQL flags,
--seed-authz,--datacenter-id, andOMS_CS_TEST_USER_PASSWORD_HASHED. Team initialization follows the application’s signup configuration rather than manually creating a team namedTests. Bootstrap generates credentials on the jumpbox; local password overrides are not forwarded.API contracts were checked against the monorepo’s auth service specification, HTTP RPC transport, and API-token specification.
Validation:
go test ./internal/testuser ./cli/cmd ./internal/bootstrap/...passes. No live account was created during validation.This PR is limited to test-user provisioning; it includes no storage or rwox-csi changes.