testutil

package
v0.0.5-alpha Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: AGPL-3.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Stackdome agent Helm chart (bundles cluster-agent + all dependencies)
	DefaultChartVersion = "0.6.12-alpha-rc1"
	ChartRepo           = "oci://quay.io/stackdome/charts/stackdome-agent"
	ChartReleaseName    = "stackdome-agent"
	ChartNamespace      = "stackdome-control-plane"

	// MinIO (S3-compatible object storage for backup tests)
	MinIOImage       = "minio/minio:latest"
	MinIOClientImage = "minio/mc:latest"
	MinIONamespace   = "stackdome-system"
	MinIOName        = "minio"
	MinIOServicePort = 9000
	MinIOAccessKey   = "minioadmin"
	MinIOSecretKey   = "minioadmin"
	MinIOBucket      = "backups"
)
View Source
const (
	HelmVersion = "v3.14.0"
)

Variables

This section is empty.

Functions

func EnsureHelm

func EnsureHelm(ctx context.Context) (string, error)

EnsureHelm returns the path to a working helm binary, installing it if necessary.

func GetChartVersion

func GetChartVersion() string

GetChartVersion returns the stackdome-agent chart version, checking environment variables.

func LoadKubernetesObjectsFromBytes

func LoadKubernetesObjectsFromBytes(fileYaml []byte) ([]unstructured.Unstructured, error)

func MinIOEndpoint

func MinIOEndpoint() string

MinIOEndpoint returns the in-cluster endpoint for the MinIO service.

func NewGitHubLoader

func NewGitHubLoader(ctx context.Context, options ...func(*githubLoader)) *githubLoader

func WithCacheDir

func WithCacheDir(cacheDir string) func(*githubLoader)

func WithPathsToLoad

func WithPathsToLoad(paths []string) func(*githubLoader)

func WithRepoName

func WithRepoName(repo string) func(*githubLoader)

func WithRepoOwner

func WithRepoOwner(owner string) func(*githubLoader)

func WithRepoTag

func WithRepoTag(tag string) func(*githubLoader)

Types

type ClusterConfig

type ClusterConfig struct {
	Name             string
	CacheDir         string
	NodeCount        int
	InstallOperators bool
	ContainerRuntime string
	Logger           logr.Logger
}

ClusterConfig holds configuration for test cluster setup

func DefaultClusterConfig

func DefaultClusterConfig(name string, logger logr.Logger) *ClusterConfig

DefaultClusterConfig returns a default configuration for test clusters

type TestCluster

type TestCluster struct {
	// contains filtered or unexported fields
}

TestCluster manages a test Kubernetes cluster

func NewTestCluster

func NewTestCluster(config *ClusterConfig) *TestCluster

NewTestCluster creates a new test cluster manager

func NewTestClusterFromKubeconfig

func NewTestClusterFromKubeconfig(kubeconfigPath string, logger logr.Logger) (*TestCluster, error)

NewTestClusterFromKubeconfig creates a TestCluster backed by an existing kubeconfig file.

func NewTestClusterFromRESTConfig

func NewTestClusterFromRESTConfig(cfg *rest.Config, logger logr.Logger) *TestCluster

NewTestClusterFromRESTConfig creates a TestCluster from an existing REST config.

func (*TestCluster) GetClient

func (tc *TestCluster) GetClient() client.Client

GetClient returns a Kubernetes client for the test cluster

func (*TestCluster) GetKubeClient

func (tc *TestCluster) GetKubeClient() (*kubernetes.Clientset, error)

GetKubeClient returns a kubernetes.Interface client for the test cluster

func (*TestCluster) GetKubeConfig

func (tc *TestCluster) GetKubeConfig() (*rest.Config, error)

GetKubeConfig returns the REST config for the test cluster (alias for GetRESTConfig)

func (*TestCluster) GetRESTConfig

func (tc *TestCluster) GetRESTConfig() *rest.Config

GetRESTConfig returns the REST config for the test cluster

func (*TestCluster) LoadImage

func (tc *TestCluster) LoadImage(imagePath string) error

LoadImage loads a container image into the cluster

func (*TestCluster) Setup

func (tc *TestCluster) Setup(ctx context.Context) error

Setup creates and initializes the test cluster

func (*TestCluster) Teardown

func (tc *TestCluster) Teardown(ctx context.Context) error

Teardown destroys the test cluster

Jump to

Keyboard shortcuts

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