test

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2021 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VSphereSecretName   = "preemption-worker-secret"
	VCSimDeploymentName = "vcsim"
	VCClientJobName     = "tagvms"
	PollInterval        = time.Second * 3
	PollTimeout         = time.Second * 30
	DeployedVMs         = 8
	TaggedVMs           = 2 // vms with preemption tag
)

Variables

View Source
var (
	DefaultLabels = map[string]string{
		"app":  "vsphere-preemption",
		"test": "e2e",
	}
)

Functions

func AddLabel

func AddLabel(labels map[string]string, label, value string) map[string]string

AddLabel creates and returns a copy of the given labels and adds the provided label and value. If labels is nil a new map will be created.

func AttachTag

func AttachTag(ctx context.Context, client *rest.Client, tag string, vms []mo.Reference) error

func CreateTag

func CreateTag(ctx context.Context, client *rest.Client, tag string) (string, error)

func GetKubeClient

func GetKubeClient(t *testing.T) (*kubernetes.Clientset, error)

func GetVMs

func GetVMs(ctx context.Context, client *govmomi.Client, path string) ([]*object.VirtualMachine, error)

func WaitDeploymentReady

func WaitDeploymentReady(ctx context.Context, client *kubernetes.Clientset, namespace, deployment string, pollInterval, pollTimeout time.Duration) error

func WaitJobComplete

func WaitJobComplete(ctx context.Context, client *kubernetes.Clientset, namespace, job string, pollInterval, pollTimeout time.Duration) error

Types

type CleanupFunc

type CleanupFunc func(ctx context.Context) error

func SetupEnvironment

func SetupEnvironment(t *testing.T, ctx context.Context, client *kubernetes.Clientset, logger *zap.Logger) (CleanupFunc, error)

type Config

type Config struct {
	KubeConfig  string `envconfig:"KUBECONFIG"`
	Namespace   string `default:"vsphere-preemption-e2e" required:"true"`
	WorkerImage string `envconfig:"WORKER_IMAGE" required:"true"` // preemption worker
	CLIImage    string `envconfig:"CLI_IMAGE" required:"true"`    // preemptctl job
	TagVmsImage string `envconfig:"TAG_VM_IMAGE" required:"true"` // job configures vcsim
	GetVMsImage string `envconfig:"GET_VM_IMAGE" required:"true"` // job reads from vcsim

	// Temporal settings (helm minimal install defaults)
	Address    string `envconfig:"TEMPORAL_URL" default:"temporaltest-frontend.default.svc.cluster.local:7233" required:"true"`
	TNamespace string `envconfig:"TEMPORAL_NAMESPACE" default:"vsphere-preemption" required:"true"`
	Queue      string `envconfig:"TEMPORAL_TASKQUEUE" default:"vsphere-preemption" required:"true"`

	// vSphere settings (vcsim defaults)
	Insecure  string `envconfig:"VCENTER_INSECURE" default:"true"`
	VCAddress string `envconfig:"VCENTER_URL" default:"https://vcsim.vsphere-preemption-e2e.svc.cluster.local" required:"true"`
	Tag       string `envconfig:"VCENTER_TAG" default:"preemptible" required:"true"`
}

type VSphereClient

type VSphereClient struct {
	Soap *govmomi.Client
	Rest *rest.Client
}

func GetVSphereClient

func GetVSphereClient(ctx context.Context, vcaddress, user, pass string, insecure bool) (*VSphereClient, error)

Directories

Path Synopsis
images

Jump to

Keyboard shortcuts

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