Documentation ¶
Overview ¶
Package vmware contains context objects for testing.
Index ¶
- func ClusterInfrastructureReady(ctx context.Context, c client.Client, clusterCache clustercache.ClusterCache, ...)
- func CreateAndWait(ctx context.Context, integrationTestClient client.Client, obj client.Object)
- func CreatePrototypePrereqs(ctx context.Context, c client.Client)
- func FakeVirtualMachineClass() *vmoprv1.VirtualMachineClass
- type IntegrationTestContext
- type UnitTestContextForController
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClusterInfrastructureReady ¶ added in v1.12.0
func ClusterInfrastructureReady(ctx context.Context, c client.Client, clusterCache clustercache.ClusterCache, cluster *clusterv1.Cluster)
ClusterInfrastructureReady sets InfrastructureReady to true so ClusterCache creates the clusterAccessor.
func CreateAndWait ¶ added in v1.9.4
CreateAndWait creates and waits for an object to exist.
func CreatePrototypePrereqs ¶
CreatePrototypePrereqs creates a prototype VirtualMachineClass.
func FakeVirtualMachineClass ¶
func FakeVirtualMachineClass() *vmoprv1.VirtualMachineClass
Types ¶
type IntegrationTestContext ¶
type IntegrationTestContext struct { Client client.Client GuestClient client.Client GuestAPIReader client.Client Namespace string VSphereCluster *vmwarev1.VSphereCluster Cluster *clusterv1.Cluster KubeconfigSecret *corev1.Secret VSphereClusterKey client.ObjectKey // contains filtered or unexported fields }
IntegrationTestContext is used for integration testing Supervisor controllers.
func NewIntegrationTestContextWithClusters ¶
func NewIntegrationTestContextWithClusters(ctx context.Context, integrationTestClient client.Client) *IntegrationTestContext
NewIntegrationTestContextWithClusters should be invoked by ginkgo.BeforeEach.
This function creates a VSphereCluster with a generated name as well as a CAPI Cluster with the same name. The function also creates a test environment and starts its API server to serve as the control plane endpoint for the guest cluster.
This function returns a IntegrationTest context.
The resources created by this function may be cleaned up by calling AfterEach with the IntegrationTestContext returned by this function.
func (*IntegrationTestContext) AfterEach ¶
func (ctx *IntegrationTestContext) AfterEach()
AfterEach should be invoked by ginko.AfterEach to stop the guest cluster's API server.
func (*IntegrationTestContext) GetLogger ¶
func (*IntegrationTestContext) GetLogger() logr.Logger
GetLogger returns a no-op logger.
type UnitTestContextForController ¶
type UnitTestContextForController struct { // GuestClusterContext is initialized with fake.NewGuestClusterContext // and is used for unit testing. *vmware.GuestClusterContext // Key may be used to lookup Ctx.Cluster with Ctx.Client.Get. Key client.ObjectKey VirtualMachineImage *vmoprv1.VirtualMachineImage ControllerManagerContext *capvcontext.ControllerManagerContext }
UnitTestContextForController is used for unit testing controllers.
func NewUnitTestContextForController ¶
func NewUnitTestContextForController(ctx context.Context, namespace string, vSphereCluster *vmwarev1.VSphereCluster, prototypeCluster bool, initObjects, gcInitObjects []client.Object) *UnitTestContextForController
NewUnitTestContextForController returns a new UnitTestContextForController with an optional prototype cluster for unit testing controllers that do not invoke the VSphereCluster spec controller.