testlib

package
v0.0.0-...-7cf7fe2 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultModel = "testlib/testdata/default"

	DefaultHostId = "host-24" // Generated by vcsim

)

Variables

View Source
var (
	NodeProperties = []string{"config.extraConfig", "config.flags", "config.version", "runtime.host"}
)

Functions

func CustomizeHostVersion

func CustomizeHostVersion(hostSystemId string, version string, apiVersion string) error

func CustomizeVM

func CustomizeVM(vmClient *vim25.Client, node *v1.Node, spec *types.VirtualMachineConfigSpec) error

func DefaultNodes

func DefaultNodes() []*v1.Node

func GetVM

func GetVM(vmClient *vim25.Client, node *v1.Node) (*mo.VirtualMachine, error)

func GetVSphereConfig

func GetVSphereConfig(fileName string) *util.VSphereConfig

func Infrastructure

func Infrastructure(modifiers ...func(*ocpv1.Infrastructure)) *ocpv1.Infrastructure

func InfrastructureWithFailureDomain

func InfrastructureWithFailureDomain(modifiers ...func(*ocpv1.Infrastructure)) *ocpv1.Infrastructure

func InfrastructureWithMultiVCenters

func InfrastructureWithMultiVCenters(modifiers ...func(*ocpv1.Infrastructure)) *ocpv1.Infrastructure

func InfrastructureWithMultipleFailureDomain

func InfrastructureWithMultipleFailureDomain(modifiers ...func(*ocpv1.Infrastructure)) *ocpv1.Infrastructure

func Node

func Node(name string, modifiers ...func(*v1.Node)) *v1.Node

func ReadFile

func ReadFile(name string) ([]byte, error)

ReadFile reads and returns the content of the named file.

func SetHardwareVersion

func SetHardwareVersion(vmClient *vim25.Client, node *v1.Node, hardwareVersion string) error

func WithProviderID

func WithProviderID(id string) func(*v1.Node)

Types

type FakeKubeClient

type FakeKubeClient struct {
	Infrastructure *ocpv1.Infrastructure
	Nodes          []*v1.Node
	StorageClasses []*storagev1.StorageClass
	PVs            []*v1.PersistentVolume
}

func (*FakeKubeClient) GetInfrastructure

func (f *FakeKubeClient) GetInfrastructure(ctx context.Context) (*ocpv1.Infrastructure, error)

func (*FakeKubeClient) ListNodes

func (f *FakeKubeClient) ListNodes(ctx context.Context) ([]*v1.Node, error)

func (*FakeKubeClient) ListPVs

func (f *FakeKubeClient) ListPVs(ctx context.Context) ([]*v1.PersistentVolume, error)

func (*FakeKubeClient) ListStorageClasses

func (f *FakeKubeClient) ListStorageClasses(ctx context.Context) ([]*storagev1.StorageClass, error)

type SimulatedVM

type SimulatedVM struct {
	Name, UUID string
}

type TestSetup

type TestSetup struct {
	Context     context.Context
	VMConfig    *util.VSphereConfig
	VCenters    map[string]*VCenter
	ClusterInfo *util.ClusterInfo
}

func SetupSimulator

func SetupSimulator(kubeClient *FakeKubeClient, modelDir string) (setup *TestSetup, cleanup func(), err error)

func SetupSimulatorWithConfig

func SetupSimulatorWithConfig(kubeClient *FakeKubeClient, modelDir, cloudConfig string) (setup *TestSetup, cleanup func(), err error)

type VCenter

type VCenter struct {
	VMClient   *vim25.Client
	TagManager *vapitags.Manager
	Username   string
}

Jump to

Keyboard shortcuts

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