Documentation ¶
Index ¶
- Constants
- Variables
- func Getenv(t *testing.T, name string, opts ...string) string
- func RandStringBytesRmndr(n int) string
- type Bash
- type BuildArg
- type Config
- type ContainerImage
- type Docker
- type DockerBuild
- type Env
- func (e *Env) DeleteTestID(t *testing.T)
- func (e *Env) DockerBuild(t *testing.T, builds []DockerBuild)
- func (e *Env) DockerPush(t *testing.T, images []ContainerImage)
- func (e *Env) GetOrGenerateTestID(t *testing.T) string
- func (e *Env) KubectlApply(t *testing.T, path string, cfg KubectlConfig)
- func (e *Env) KubectlEnsureClusterRoleBindingServiceAccount(t *testing.T, bindingName string, clusterrole string, serviceaccount string, ...)
- func (e *Env) KubectlEnsureNS(t *testing.T, name string, cfg KubectlConfig)
- func (e *Env) KubectlWaitUntilDeployAvailable(t *testing.T, name string, cfg KubectlConfig)
- func (e *Env) RunScript(t *testing.T, path string, cfg ScriptConfig)
- type GitRepo
- type InputSpec
- type Job
- type Kind
- func (k *Kind) Kubeconfig() string
- func (k *Kind) LoadImages(ctx context.Context, images []ContainerImage) error
- func (k *Kind) PullImages(ctx context.Context, images []ContainerImage) error
- func (k *Kind) Start(ctx context.Context, k8sMinorVer string) error
- func (k *Kind) Stop(ctx context.Context) error
- type Kubectl
- func (k *Kubectl) Apply(ctx context.Context, path string, cfg KubectlConfig) error
- func (k *Kubectl) CreateCMLiterals(ctx context.Context, name string, literals map[string]string, ...) error
- func (k *Kubectl) CreateClusterRoleBindingServiceAccount(ctx context.Context, name string, clusterrole string, sa string, ...) error
- func (k *Kubectl) DeleteCM(ctx context.Context, name string, cfg KubectlConfig) error
- func (k *Kubectl) DeletePods(ctx context.Context, names []string, cfg KubectlConfig) error
- func (k *Kubectl) EnsureNS(ctx context.Context, name string, cfg KubectlConfig) error
- func (k *Kubectl) FindPods(ctx context.Context, label string, cfg KubectlConfig) ([]string, error)
- func (k *Kubectl) GetCMLiterals(ctx context.Context, name string, cfg KubectlConfig) (map[string]string, error)
- func (k *Kubectl) GetClusterRoleBinding(ctx context.Context, name string, cfg KubectlConfig) (string, error)
- func (k *Kubectl) WaitUntilDeployAvailable(ctx context.Context, name string, cfg KubectlConfig) error
- type KubectlConfig
- type On
- type Option
- type Push
- type ScriptConfig
- type Step
- type T
- type With
- type Workflow
- type WorkflowDispatch
Constants ¶
View Source
const (
ActionsCheckout = "actions/checkout@v3"
)
Variables ¶
View Source
var Short = testing.Short
Functions ¶
func RandStringBytesRmndr ¶
Copied from https://stackoverflow.com/a/31832326 with thanks
Types ¶
type Config ¶
type Config struct { // PreloadImages is the list of container images to be pulled and loaded into the cluster. // This might be useful to speed up your test by avoiding to let dockerd pull images from the internet each time you need to // run tests. PreloadImages []ContainerImage }
type ContainerImage ¶
type ContainerImage struct {
Repo, Tag string
}
func Img ¶
func Img(repo, tag string) ContainerImage
type DockerBuild ¶
type DockerBuild struct { Dockerfile string Args []BuildArg Image ContainerImage EnableBuildX bool }
type Env ¶
Env is a testing environment. All of its methods are idempotent so that you can safely call it from within each subtest and you can rerun the individual subtest until it works as you expect.
func (*Env) DeleteTestID ¶
func (*Env) DockerBuild ¶
func (e *Env) DockerBuild(t *testing.T, builds []DockerBuild)
func (*Env) DockerPush ¶
func (e *Env) DockerPush(t *testing.T, images []ContainerImage)
func (*Env) KubectlApply ¶
func (e *Env) KubectlApply(t *testing.T, path string, cfg KubectlConfig)
func (*Env) KubectlEnsureClusterRoleBindingServiceAccount ¶
func (*Env) KubectlEnsureNS ¶
func (e *Env) KubectlEnsureNS(t *testing.T, name string, cfg KubectlConfig)
func (*Env) KubectlWaitUntilDeployAvailable ¶
func (e *Env) KubectlWaitUntilDeployAvailable(t *testing.T, name string, cfg KubectlConfig)
type GitRepo ¶
type Kind ¶
type Kind struct { // Name is the name of the cluster Name string // Dir is the path to the directory that contains various temporary files like a kind cluster config yaml for testing. // This is occasionally the value returned by testing.TempDir() so that // you don't need to clean it up yourself. Dir string runtime.Cmdr // contains filtered or unexported fields }
Kind is a test cluster backend by a kind cluster and the dockerd powering it. It intracts with the kind cluster via the kind command and dockerd via the docker command for various operations that otherwise needs to be automated via shell scripts or makefiles.
func (*Kind) Kubeconfig ¶
func (*Kind) LoadImages ¶
func (k *Kind) LoadImages(ctx context.Context, images []ContainerImage) error
func (*Kind) PullImages ¶
func (k *Kind) PullImages(ctx context.Context, images []ContainerImage) error
type Kubectl ¶
func (*Kubectl) CreateCMLiterals ¶
func (*Kubectl) CreateClusterRoleBindingServiceAccount ¶
func (*Kubectl) DeletePods ¶
func (*Kubectl) GetCMLiterals ¶
func (*Kubectl) GetClusterRoleBinding ¶
func (*Kubectl) WaitUntilDeployAvailable ¶
type KubectlConfig ¶
func (KubectlConfig) WithTimeout ¶
func (k KubectlConfig) WithTimeout(o time.Duration) KubectlConfig
type On ¶
type On struct { Push *Push `json:"push,omitempty"` WorkflowDispatch *WorkflowDispatch `json:"workflow_dispatch,omitempty"` }
type Option ¶
type Option = func(*Config)
func Preload ¶
func Preload(imgs ...ContainerImage) Option
type ScriptConfig ¶
type With ¶
type With struct { Version string `json:"version,omitempty"` GoVersion string `json:"go-version,omitempty"` // https://github.com/docker/setup-buildx-action#inputs BuildkitdFlags string `json:"buildkitd-flags,omitempty"` Install bool `json:"install,omitempty"` // This can be either the address or the context name // https://github.com/docker/buildx/blob/master/docs/reference/buildx_create.md#description Endpoint string `json:"endpoint,omitempty"` // Needs to be "docker" in rootless mode // https://stackoverflow.com/questions/66142872/how-to-solve-error-with-rootless-docker-in-github-actions-self-hosted-runner-wr Driver string `json:"driver,omitempty"` // Image is the image arg passed to docker-run-action Image string `json:"image,omitempty"` // Run is the run arg passed to docker-run-action Run string `json:"run,omitempty"` // Shell is the shell arg passed to docker-run-action Shell string `json:"shell,omitempty"` }
type WorkflowDispatch ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.