Documentation
¶
Index ¶
- Constants
- Variables
- func CheckBillingStatus(teamId string) (bool, string)
- func CleanupTeam(teamId string)
- func CleanupWorkspace(workspaceId string)
- func CreateTestWorkspace(teamId, workspaceName string) string
- func ExtractTeamId(output string) string
- func ExtractWorkspaceId(output string) string
- func FailIfMissingEnvVars() (teamId, token string)
- func GenerateTLSCerts(outputDir string, serverCN string, serverSANs []string) (caCertPath, serverCertPath, serverKeyPath string, err error)
- func GetEphemeralPort() (int, error)
- func LintDockerfile(path string) error
- func LintKubernetesManifest(path string) error
- func LintShellScript(path string) error
- func NewWorkspaceName(prefix string) string
- func RunCommand(args ...string) string
- func RunCommandInBackground(outputBuffer *bytes.Buffer, args ...string) *exec.Cmd
- func RunCommandWithExitCode(args ...string) (string, int)
- func ScaleWorkspace(client *api.Client, workspaceId int, replicas int) error
- func StartTestHttpServer(port int) (*http.Server, error)
- func StartTestHttpsServer(port int, certFile, keyFile string) (*http.Server, error)
- func VerifyWorkspaceDeleted(workspaceId, teamId string) bool
- func VerifyWorkspaceExists(workspaceId, teamId string) bool
- func WaitForPort(addr string, timeout time.Duration)
- func WaitForWorkspaceRunning(client *api.Client, workspaceId int, timeout time.Duration) error
- func WithClearedWorkspaceEnv(fn func())
Constants ¶
const ( DefaultPlanId = "8" DefaultCreateTimeout = "15m" NonExistentWorkspaceId = "99999999" WorkspaceCreatedOutput = "Workspace created" )
const ( HadolintTool = "hadolint" ShellcheckTool = "shellcheck" KubeconformTool = "kubeconform" )
Variables ¶
var ErrToolNotFound = errors.New("tool not found on $PATH")
var PostCreateWaitTime = 5 * time.Second
var WorkspaceNamePrefixes = []string{
"cli-git-test-",
"cli-pipeline-test-",
"cli-log-test-",
"cli-open-test-",
"cli-setenv-test-",
"cli-edge-test-",
"cli-very-long-workspace-name-test-",
"cli-wakeup-test-",
"cli-curl-test-",
}
WorkspaceNamePrefixes contains all workspace name prefixes used by integration tests. This is used for global cleanup in AfterSuite to catch orphaned workspaces.
Functions ¶
func CheckBillingStatus ¶ added in v0.14.2
func CleanupTeam ¶ added in v0.14.2
func CleanupTeam(teamId string)
func CleanupWorkspace ¶ added in v0.14.2
func CleanupWorkspace(workspaceId string)
func CreateTestWorkspace ¶ added in v0.20.0
CreateTestWorkspace creates a workspace with standard settings and returns the workspace ID. It fails the test if creation fails or no workspace ID is returned.
func ExtractTeamId ¶ added in v0.14.2
func ExtractWorkspaceId ¶ added in v0.14.2
func FailIfMissingEnvVars ¶ added in v0.20.0
func FailIfMissingEnvVars() (teamId, token string)
func GenerateTLSCerts ¶
func GenerateTLSCerts(outputDir string, serverCN string, serverSANs []string) (caCertPath, serverCertPath, serverKeyPath string, err error)
GenerateTLSCerts generates a CA, a server key, and a server certificate signed by the CA. It includes Subject Alternative Names (SANs) for modern TLS compliance. Returns paths to ca.crt, server.crt, and server.key.
func GetEphemeralPort ¶
GetEphemeralPort finds an available ephemeral port on localhost.
func LintDockerfile ¶ added in v0.20.0
LintDockerfile runs hadolint on the Dockerfile at the given path.
func LintKubernetesManifest ¶ added in v0.20.0
LintKubernetesManifest runs kubeconform on the Kubernetes manifest at the given path.
func LintShellScript ¶ added in v0.20.0
LintShellScript runs shellcheck on the shell script at the given path.
func NewWorkspaceName ¶ added in v0.20.0
NewWorkspaceName generates a unique workspace name with the given prefix.
func RunCommand ¶ added in v0.14.2
func RunCommandInBackground ¶
func RunCommandWithExitCode ¶ added in v0.14.2
func ScaleWorkspace ¶ added in v0.17.0
func StartTestHttpServer ¶
Helper to start a simple HTTP server (for non-TLS tests)
func StartTestHttpsServer ¶
Helper to start a simple HTTPS server with custom certs
func VerifyWorkspaceDeleted ¶ added in v0.14.2
func VerifyWorkspaceExists ¶ added in v0.14.2
func WaitForPort ¶
WaitForPort blocks until a TCP port is listening or timeout occurs.
func WaitForWorkspaceRunning ¶ added in v0.14.2
func WithClearedWorkspaceEnv ¶ added in v0.20.0
func WithClearedWorkspaceEnv(fn func())
WithClearedWorkspaceEnv temporarily unsets CS_WORKSPACE_ID and WORKSPACE_ID, calls fn, then restores the original values.
Types ¶
This section is empty.