Documentation ¶
Index ¶
- Constants
- type TestContext
- func (testCtx TestContext) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error
- func (testCtx TestContext) CreateNamespace() error
- func (testCtx TestContext) GetNamespaceKey() client.ObjectKey
- func (testCtx TestContext) GetNamespaceObj() corev1.Namespace
- func (testCtx TestContext) GetRandomStr() string
- func (testCtx TestContext) GetWebhookHostExternalName() string
- func (testCtx TestContext) UseDefaultNamespace() func(client.Object)
- func (testCtx TestContext) UsingExistingCluster() bool
Constants ¶
View Source
const ( DefaultStorageProvisoner = "kubernetes.io/no-provisioner" DefaultCSIDriver = "hostpath.csi.k8s.io" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TestContext ¶
type TestContext struct { Ctx context.Context Cli client.Client TestEnv *envtest.Environment TestObjLabelKey string DefaultNamespace string DefaultEventuallyTimeout time.Duration DefaultEventuallyPollingInterval time.Duration DefaultConsistentlyDuration time.Duration DefaultConsistentlyPollingInterval time.Duration ClearResourceTimeout time.Duration ClearResourcePollingInterval time.Duration CreateObj func(ctx context.Context, obj client.Object, opts ...client.CreateOption) error CheckedCreateObj func(ctx context.Context, obj client.Object, opts ...client.CreateOption) error }
func NewDefaultTestContext ¶
func NewDefaultTestContext(ctx context.Context, cli client.Client, testEnv *envtest.Environment, namespace ...string) TestContext
NewDefaultTestContext creates default test context, if provided namespace optional arg, a namespace will be created if not exist
func (TestContext) Create ¶
func (testCtx TestContext) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error
func (TestContext) CreateNamespace ¶
func (testCtx TestContext) CreateNamespace() error
func (TestContext) GetNamespaceKey ¶
func (testCtx TestContext) GetNamespaceKey() client.ObjectKey
func (TestContext) GetNamespaceObj ¶
func (testCtx TestContext) GetNamespaceObj() corev1.Namespace
func (TestContext) GetRandomStr ¶
func (testCtx TestContext) GetRandomStr() string
func (TestContext) GetWebhookHostExternalName ¶
func (testCtx TestContext) GetWebhookHostExternalName() string
func (TestContext) UseDefaultNamespace ¶
func (testCtx TestContext) UseDefaultNamespace() func(client.Object)
func (TestContext) UsingExistingCluster ¶
func (testCtx TestContext) UsingExistingCluster() bool
Click to show internal directories.
Click to hide internal directories.