cases

package
v0.2.53 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func EdgeLifecycle

func EdgeLifecycle() features.Feature

EdgeLifecycle returns a feature that creates, lists, and deletes an edge.

func HubHealth

func HubHealth() features.Feature

HubHealth returns a feature that asserts /healthz and /readyz return 200.

func MultiOrgIsolation

func MultiOrgIsolation() features.Feature

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

func SSHDockerServerModeConnect() features.Feature

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

func SSHEdgeURLSet() features.Feature

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

func SSHServerModeConnect() features.Feature

SSHServerModeConnect verifies the full SSH path end-to-end:

  1. Start an embedded test SSH server + railgrid agent (--mode=server) as subprocesses
  2. Wait for the Edge resource to become Ready on the hub
  3. Run `railgrid ssh <name> -- echo <marker>` and verify the marker in output
  4. Verify interactive PTY (WebSocket, resize, keystrokes, output)
  5. Hold the session for the configured duration and assert it stays alive

func SSHUserMappingIdentity

func SSHUserMappingIdentity() features.Feature

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

func SSHUserMappingInherited() features.Feature

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

func StaticTokenLogin() features.Feature

StaticTokenLogin returns a feature that asserts railgrid login succeeds with the static dev-token.

func TenancyOrgCRUD

func TenancyOrgCRUD() features.Feature

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

func TenancyPersonalOrgSoftDelete() features.Feature

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

func TenancySACRUD() features.Feature

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

func TenancySATokenAccess() features.Feature

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

func TenancySATokenCrossWorkspace() features.Feature

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

func TenancySoftDeleteHidesOrg() features.Feature

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

func TenancyTenantHeaders() features.Feature

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

func TenancyWorkspaceCRUD() features.Feature

TenancyWorkspaceCRUD creates an org, then walks the workspace lifecycle: create → patch displayName → soft-delete → undelete.

func WorkspaceAccessIsolation added in v0.2.47

func WorkspaceAccessIsolation() features.Feature

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL