Documentation
¶
Index ¶
- func AcquireE2ELock(ctx context.Context, clusterName string, timeout time.Duration) (func(), error)
- func ApplyInfraAllSecrets(ctx context.Context, kubeconfig, namespace string) error
- func ApplyInfraControlPlaneSecrets(ctx context.Context, kubeconfig, namespace string) error
- func ApplyInfraDataPlaneSecrets(ctx context.Context, kubeconfig, namespace string) error
- func ApplyManifest(ctx context.Context, kubeconfig, manifestPath string) error
- func ApplyManifestContent(ctx context.Context, kubeconfig, prefix, content string) error
- func ApplySecret(ctx context.Context, kubeconfig string, spec SecretSpec) error
- func DiscoverSampleManifests(cfg Config, clusterType string) ([]string, error)
- func EnsureNamespace(ctx context.Context, kubeconfig, namespace string) error
- func FindInfraRoot() (string, error)
- func GetSecretValue(ctx context.Context, kubeconfig, namespace, secretName, key string) (string, error)
- func GetServicePort(ctx context.Context, kubeconfig, namespace, service string) (int, error)
- func HelmUninstall(ctx context.Context, releaseName, namespace, kubeconfig string) error
- func HelmUpgradeInstall(ctx context.Context, ...) error
- func InstallOperator(ctx context.Context, cfg Config) error
- func Kubectl(ctx context.Context, kubeconfig string, args ...string) error
- func KubectlDeleteManifest(ctx context.Context, kubeconfig, manifestPath string) error
- func KubectlExecContainerOutput(ctx context.Context, kubeconfig, namespace, pod, container string, ...) (string, error)
- func KubectlExecOutput(ctx context.Context, kubeconfig, namespace, pod string, command ...string) (string, error)
- func KubectlGetJSONPath(ctx context.Context, kubeconfig, namespace, resource, name, jsonPath string) (string, error)
- func KubectlOutput(ctx context.Context, kubeconfig string, args ...string) (string, error)
- func KubectlPatch(ctx context.Context, kubeconfig, namespace, resource, name, patch string) error
- func KubectlRolloutStatus(ctx context.Context, kubeconfig, namespace, resource, timeout string) error
- func KubectlWaitForCondition(ctx context.Context, ...) error
- func KubectlWaitForDelete(ctx context.Context, kubeconfig, namespace, resource, name, timeout string) error
- func PortForwardService(ctx context.Context, kubeconfig, namespace, service string, remotePort int) (string, func(), error)
- func ResolveSamplePath(cfg Config, relativePath string) (string, error)
- func RunCommand(ctx context.Context, name string, args ...string) error
- func RunCommandOutput(ctx context.Context, name string, args ...string) (string, error)
- func UninstallOperator(ctx context.Context, cfg Config) error
- func WaitForDeployment(ctx context.Context, kubeconfig, namespace, name string, timeout string) error
- func WaitForOperatorReady(ctx context.Context, cfg Config, timeout string) error
- func WaitForSandbox0InfraReady(ctx context.Context, kubeconfig string, infra InfraConfig, timeout string) error
- type Cluster
- type Config
- type InfraConfig
- type RolloutTarget
- type Scenario
- type ScenarioEnv
- type SecretSpec
- type TestContext
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AcquireE2ELock ¶
AcquireE2ELock acquires a file lock for a given cluster name. It blocks with retries until the lock is acquired or timeout is reached.
func ApplyInfraAllSecrets ¶
func ApplyManifest ¶
ApplyManifest applies a YAML manifest to the cluster using kubectl.
func ApplyManifestContent ¶ added in v0.2.0
func ApplySecret ¶
func ApplySecret(ctx context.Context, kubeconfig string, spec SecretSpec) error
func DiscoverSampleManifests ¶
DiscoverSampleManifests returns sorted sample manifest paths.
func EnsureNamespace ¶
func FindInfraRoot ¶
FindInfraRoot locates the infra module root by searching for go.mod.
func GetSecretValue ¶
func GetSecretValue(ctx context.Context, kubeconfig, namespace, secretName, key string) (string, error)
GetSecretValue reads a base64-encoded secret key value.
func GetServicePort ¶
GetServicePort returns the first port exposed by a service.
func HelmUninstall ¶
HelmUninstall removes a release using helm.
func HelmUpgradeInstall ¶
func HelmUpgradeInstall(ctx context.Context, releaseName, chartPath, namespace, kubeconfig, valuesPath string, setValues []string) error
HelmUpgradeInstall installs or upgrades a release using helm.
func InstallOperator ¶
InstallOperator installs or upgrades the infra-operator chart.
func KubectlDeleteManifest ¶
KubectlDeleteManifest deletes resources from a manifest file.
func KubectlExecContainerOutput ¶ added in v0.2.0
func KubectlExecContainerOutput(ctx context.Context, kubeconfig, namespace, pod, container string, command ...string) (string, error)
KubectlExecContainerOutput runs kubectl exec against a specific container and returns output.
func KubectlExecOutput ¶ added in v0.2.0
func KubectlExecOutput(ctx context.Context, kubeconfig, namespace, pod string, command ...string) (string, error)
KubectlExecOutput runs kubectl exec and returns output.
func KubectlGetJSONPath ¶
func KubectlGetJSONPath(ctx context.Context, kubeconfig, namespace, resource, name, jsonPath string) (string, error)
KubectlGetJSONPath fetches a jsonpath value for a resource.
func KubectlOutput ¶
KubectlOutput runs a kubectl command and returns output.
func KubectlPatch ¶
KubectlPatch applies a merge patch to a resource.
func KubectlRolloutStatus ¶
func KubectlRolloutStatus(ctx context.Context, kubeconfig, namespace, resource, timeout string) error
KubectlRolloutStatus waits for a rollout to finish.
func KubectlWaitForCondition ¶
func KubectlWaitForCondition(ctx context.Context, kubeconfig, namespace, resource, name, condition, timeout string) error
KubectlWaitForCondition waits for a condition on a resource.
func KubectlWaitForDelete ¶
func KubectlWaitForDelete(ctx context.Context, kubeconfig, namespace, resource, name, timeout string) error
KubectlWaitForDelete waits for a resource to be deleted.
func PortForwardService ¶
func PortForwardService(ctx context.Context, kubeconfig, namespace, service string, remotePort int) (string, func(), error)
PortForwardService starts a kubectl port-forward to a service.
func ResolveSamplePath ¶
ResolveSamplePath returns the absolute path for a chart sample file.
func RunCommand ¶
RunCommand executes a command and returns a detailed error on failure.
func RunCommandOutput ¶
RunCommandOutput executes a command and returns stdout/stderr on success.
func UninstallOperator ¶
UninstallOperator removes the infra-operator release.
func WaitForDeployment ¶
func WaitForDeployment(ctx context.Context, kubeconfig, namespace, name string, timeout string) error
WaitForDeployment waits until a deployment is ready.
func WaitForOperatorReady ¶
WaitForOperatorReady waits until the operator deployment is ready.
func WaitForSandbox0InfraReady ¶
func WaitForSandbox0InfraReady(ctx context.Context, kubeconfig string, infra InfraConfig, timeout string) error
WaitForSandbox0InfraReady waits for the Ready condition.
Types ¶
type Cluster ¶
Cluster manages a Kind-backed Kubernetes cluster for E2E tests.
func NewCluster ¶
NewCluster creates a new cluster descriptor.
func (*Cluster) CreateKind ¶
CreateKind creates a Kind cluster with the provided config file. If the cluster already exists, it does nothing and returns nil.
func (*Cluster) DeleteKind ¶
DeleteKind deletes the Kind cluster.
func (*Cluster) ExportKubeconfig ¶
ExportKubeconfig exports the cluster kubeconfig to a temporary file and returns the path.
type Config ¶
type Config struct {
ClusterName string
KindConfigPath string
Kubeconfig string
UseExistingCluster bool
SkipClusterDelete bool
SkipOperatorInstall bool
SkipOperatorUninstall bool
OperatorChartPath string
OperatorNamespace string
OperatorReleaseName string
OperatorDeploymentName string
OperatorValuesPath string
OperatorImageRepo string
OperatorImageTag string
OperatorImagePullPolicy string
InfraNamespace string
}
Config defines E2E runtime configuration.
func LoadConfig ¶
LoadConfig reads E2E configuration from environment variables.
type InfraConfig ¶
InfraConfig identifies a Sandbox0Infra instance for E2E tests.
type RolloutTarget ¶
RolloutTarget represents a workload to wait on.
func (RolloutTarget) ResourceID ¶
func (r RolloutTarget) ResourceID() (string, error)
ResourceID returns the kubernetes resource reference for rollout checks.
type Scenario ¶
type Scenario struct {
Name string
ManifestPath string
InfraName string
InfraNamespace string
Secrets []SecretSpec
Rollouts []RolloutTarget
ReadyTimeout string
}
Scenario describes a test environment driven by a sample manifest.
type ScenarioEnv ¶
type ScenarioEnv struct {
Config Config
Scenario Scenario
TestCtx *TestContext
Infra InfraConfig
}
ScenarioEnv binds runtime config to a scenario.
func SetupScenario ¶
func SetupScenario(cfg Config, scenario Scenario) (*ScenarioEnv, func(), error)
SetupScenario provisions a cluster, installs the operator, and applies a sample manifest.
type SecretSpec ¶
func AdminPasswordSecret ¶
func AdminPasswordSecret(namespace string) SecretSpec
AdminPasswordSecret returns a randomized admin password secret spec.
type TestContext ¶
type TestContext struct {
Context context.Context
Cluster *Cluster
Namespace string
StartedAt time.Time
Timeout time.Duration
RetryDelay time.Duration
}
TestContext carries shared dependencies across suites.
func NewTestContext ¶
func NewTestContext(cluster *Cluster) *TestContext
NewTestContext creates a base context for E2E suites.