Documentation
¶
Overview ¶
Package cases contains shared e2e test case builders that are reused across multiple test suites. Each function returns a features.Feature that can be handed to testenv.Test(t, feature) in any suite.
Index ¶
- func EdgeLifecycle() features.Feature
- func HubHealth() features.Feature
- func MultiOrgIsolation() features.Feature
- func SSHDockerServerModeConnect() features.Feature
- func SSHEdgeURLSet() features.Feature
- func SSHServerModeConnect() features.Feature
- func SSHUserMappingIdentity() features.Feature
- func SSHUserMappingInherited() features.Feature
- func StaticTokenLogin() features.Feature
- func TenancyOrgCRUD() features.Feature
- func TenancyPersonalOrgSoftDelete() features.Feature
- func TenancySACRUD() features.Feature
- func TenancySATokenAccess() features.Feature
- func TenancySATokenCrossWorkspace() features.Feature
- func TenancySoftDeleteHidesOrg() features.Feature
- func TenancyTenantHeaders() features.Feature
- func TenancyWorkspaceCRUD() features.Feature
- func WorkspaceAccessIsolation() features.Feature
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EdgeLifecycle ¶
EdgeLifecycle returns a feature that creates, lists, and deletes an edge.
func MultiOrgIsolation ¶
MultiOrgIsolation is a comprehensive isolation test for the hub REST surface from PR #214. It verifies that User B (a different OIDC identity than User A) cannot observe or mutate any of the org, workspace, membership, or service-account state User A creates.
Requires the OIDC suite (two static users in Dex).
func SSHDockerServerModeConnect ¶
SSHDockerServerModeConnect is the Docker-based variant of SSHServerModeConnect. It runs lscr.io/linuxserver/openssh-server in a container (--network host) alongside a railgrid server-mode agent, and verifies the full SSH path through the hub tunnel.
The agent authenticates using a real hub-generated join token (not a static dev token) to exercise the full join-token bootstrap flow end-to-end.
func SSHEdgeURLSet ¶
SSHEdgeURLSet verifies that status.URL is populated for server-type edges and that the URL ends in "/ssh". It follows the same setup as SSHServerModeConnect but only asserts on the URL field.
func SSHServerModeConnect ¶
SSHServerModeConnect verifies the full SSH path end-to-end:
- Start an embedded test SSH server + railgrid agent (--mode=server) as subprocesses
- Wait for the Edge resource to become Ready on the hub
- Run `railgrid ssh <name> -- echo <marker>` and verify the marker in output
- Verify interactive PTY (WebSocket, resize, keystrokes, output)
- Hold the session for the configured duration and assert it stays alive
func SSHUserMappingIdentity ¶
SSHUserMappingIdentity verifies that when sshUserMapping=identity, the hub uses the caller's kcp/OIDC username as the SSH username. The SSH key comes from spec.server.sshCredentialsRef.
func SSHUserMappingInherited ¶
SSHUserMappingInherited verifies that when sshUserMapping=inherited (or unset / default), the hub uses credentials reported by the agent at registration time (Edge.Status.SSHCredentials). The agent is started with --ssh-user=testuser --ssh-password=testpassword; the test runs `echo $USER` over SSH and checks the output is "testuser".
func StaticTokenLogin ¶
StaticTokenLogin returns a feature that asserts railgrid login succeeds with the static dev-token.
func TenancyOrgCRUD ¶
TenancyOrgCRUD walks the full Org lifecycle: create → get → rename → soft-delete → check deletionRequestedAt → undelete → re-rename → final soft-delete. Each step is a separate assess so a regression in one stage doesn't mask later behaviour.
func TenancyPersonalOrgSoftDelete ¶
TenancyPersonalOrgSoftDelete verifies the API contract for the caller's personal org: the bootstrap creates one on first /api/orgs call, a direct DELETE on it is accepted (the soft-delete reconciler picks it up), and Undelete restores it within the grace window. Pins the API behavior so a future guardrail addition has to update this test rather than silently change behavior.
func TenancySACRUD ¶
TenancySACRUD walks the SA lifecycle: create → list → issue token → revoke (DELETE all tokens) → delete SA. Token usage against a tenancy endpoint is verified in TenancySATokenAccess below.
func TenancySATokenAccess ¶
TenancySATokenAccess verifies an issued SA token can actually authenticate against the workspace whose endpoints it was minted for. Without this the rest of the SA tests only prove the surface accepts our calls, not that tokens are real.
func TenancySATokenCrossWorkspace ¶
TenancySATokenCrossWorkspace verifies that a SA token issued in (orgA, wsA) does not work against (orgB, wsB) belonging to a different user. Skipped outside the OIDC suite (we need two distinct identities).
func TenancySoftDeleteHidesOrg ¶
TenancySoftDeleteHidesOrg verifies the UMI-driven org list does not expose soft-deleted orgs to the caller, but does expose them again after undelete. This is the observable contract; whether the marker lives on the Org CR or on the UMI entry is implementation detail.
func TenancyTenantHeaders ¶
TenancyTenantHeaders verifies the tenant middleware rejects requests where the X-Railgrid-Org/X-Railgrid-Workspace headers are missing, point at a non-existent org, or don't match the URL path.
func TenancyWorkspaceCRUD ¶
TenancyWorkspaceCRUD creates an org, then walks the workspace lifecycle: create → patch displayName → soft-delete → undelete.
func WorkspaceAccessIsolation ¶ added in v0.2.47
WorkspaceAccessIsolation verifies that kcp alone gates workspace access through the hub: each user reaches only the workspace clusters their Memberships have RBAC for, cross-user access is refused by kcp until granted, and a request that names no workspace is not served as if it had.
Types ¶
This section is empty.