Documentation
¶
Index ¶
- func DeployApp(t *testing.T, m *Miren, opts AppOptions) string
- func GetSandboxID(t *testing.T, m *Miren, appName string) string
- func HTTPGet(m *Miren, hostname, path string) (statusCode int, body string, err error)
- func Poll(t *testing.T, description string, timeout, interval time.Duration, ...)
- func UniqueAppName(t *testing.T, base string) string
- func WaitForAppReady(t *testing.T, m *Miren, name string, timeout time.Duration)
- type AppOptions
- type Cluster
- type Miren
- type Mode
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeployApp ¶
func DeployApp(t *testing.T, m *Miren, opts AppOptions) string
DeployApp deploys a testdata application, registers cleanup, and waits for it to become ready. It returns the app name.
func GetSandboxID ¶
GetSandboxID returns the ID of a running sandbox for the given app by parsing the JSON output of `sandbox list --format json`.
func HTTPGet ¶ added in v0.6.0
HTTPGet makes an HTTP GET request from inside the dev container via curl. The host header is set to the given hostname so ingress routing works, while the actual request goes to localhost:443 over HTTPS (with -k to skip certificate verification). Port 80 redirects to HTTPS, so we connect directly to avoid redirect resolution issues.
func Poll ¶
func Poll(t *testing.T, description string, timeout, interval time.Duration, condition func() (done bool, msg string))
Poll repeatedly calls condition until it returns true or the timeout expires. On timeout, it fails the test with the last message from the condition.
func UniqueAppName ¶
UniqueAppName generates a short app name unique to this test and process. The format is bb-<base>-<hash> where hash is 6 hex chars derived from the test name plus a process-unique run ID to avoid collisions across concurrent runs.
Types ¶
type AppOptions ¶
type AppOptions struct {
// Name overrides the generated app name. If empty, one is derived from the
// test name and Testdata value.
Name string
// Testdata is the directory name under testdata/ to deploy (e.g. "go-server").
Testdata string
// Env is a list of KEY=VALUE pairs to pass via -e flags.
Env []string
// ReadyTimeout is how long to wait for the app to become healthy after deploy.
// Defaults to 2 minutes.
ReadyTimeout time.Duration
}
AppOptions configures a test app deployment.
type Cluster ¶
type Cluster struct {
Mode Mode
RepoRoot string
TestdataDir string
MirenBin string // only used in local mode
}
Cluster holds targeting information for a test run.
func NewCluster ¶
NewCluster reads environment variables and returns a configured Cluster. It fails the test if required configuration is missing.
type Miren ¶
type Miren struct {
// contains filtered or unexported fields
}
Miren wraps CLI execution against a target cluster.
func (*Miren) ContainerPath ¶
ContainerPath translates a host-side path to a container-internal path. In dev mode, the repo is mounted at /src inside the iso container.
type Result ¶
Result captures the output of a CLI invocation.
func (*Result) OutputContains ¶
OutputContains checks whether stdout or stderr contains the given substring.
func (*Result) RequireContains ¶
RequireContains fails the test if neither stdout nor stderr contains substr.
func (*Result) RequireExitCode ¶
RequireExitCode fails the test if the exit code doesn't match.
func (*Result) RequireSuccess ¶
RequireSuccess fails the test if the command did not exit with code 0.