Documentation ¶
Index ¶
- Constants
- func AccessListCreationTest(t *testing.T, clt *client.Client)
- func AccessListDeletionDriftTest(t *testing.T, clt *client.Client)
- func AccessListMutateExistingTest(t *testing.T, clt *client.Client)
- func AccessListUpdateTest(t *testing.T, clt *client.Client)
- func CompareOptions(customOpts ...cmp.Option) []cmp.Option
- func FastEventually(t *testing.T, condition func() bool)
- func FastEventuallyWithT(t *testing.T, condition func(collectT *assert.CollectT))
- func LoginRuleCreationTest(t *testing.T, clt *client.Client)
- func LoginRuleDeletionDriftTest(t *testing.T, clt *client.Client)
- func LoginRuleUpdateTest(t *testing.T, clt *client.Client)
- func ResourceCreationTest[T resources.TeleportResource, K resources.TeleportKubernetesResource[T]](t *testing.T, test ResourceTestingPrimitives[T, K], opts ...TestOption)
- func ResourceDeletionDriftTest[T resources.TeleportResource, K resources.TeleportKubernetesResource[T]](t *testing.T, test ResourceTestingPrimitives[T, K], opts ...TestOption)
- func ResourceUpdateTest[T resources.TeleportResource, K resources.TeleportKubernetesResource[T]](t *testing.T, test ResourceTestingPrimitives[T, K], opts ...TestOption)
- func StepByStep(setup *TestSetup)
- func ValidRandomResourceName(prefix string) string
- type ResourceTestingPrimitives
- type TestOption
- type TestSetup
Constants ¶
const MaxTimeDiff = 2 * time.Millisecond
MaxTimeDiff is used when writing tests comparing times. Timestamps suffer from being serialized/deserialized with different precisions, the final value might be a bit different from the initial one. If the difference is less than MaxTimeDiff, we consider the values equal.
Variables ¶
This section is empty.
Functions ¶
func AccessListMutateExistingTest ¶
AccessListMutateExistingTest checks that the operator propagates the expiry from the existing access list to the new one it will upsert.
func CompareOptions ¶
CompareOptions builds comparison options by returning a slice of both default comparison options and optional custom ones for the test/resource.
func FastEventually ¶
func FastEventuallyWithT ¶
func ResourceCreationTest ¶
func ResourceCreationTest[T resources.TeleportResource, K resources.TeleportKubernetesResource[T]](t *testing.T, test ResourceTestingPrimitives[T, K], opts ...TestOption)
func ResourceDeletionDriftTest ¶
func ResourceDeletionDriftTest[T resources.TeleportResource, K resources.TeleportKubernetesResource[T]](t *testing.T, test ResourceTestingPrimitives[T, K], opts ...TestOption)
func ResourceUpdateTest ¶
func ResourceUpdateTest[T resources.TeleportResource, K resources.TeleportKubernetesResource[T]](t *testing.T, test ResourceTestingPrimitives[T, K], opts ...TestOption)
func StepByStep ¶
func StepByStep(setup *TestSetup)
func ValidRandomResourceName ¶
Types ¶
type ResourceTestingPrimitives ¶
type ResourceTestingPrimitives[T resources.TeleportResource, K resources.TeleportKubernetesResource[T]] interface { Init(setup *TestSetup) SetupTeleportFixtures(context.Context) error // Interacting with the Teleport Resource CreateTeleportResource(context.Context, string) error GetTeleportResource(context.Context, string) (T, error) DeleteTeleportResource(context.Context, string) error // Interacting with the Kubernetes Resource CreateKubernetesResource(context.Context, string) error DeleteKubernetesResource(context.Context, string) error GetKubernetesResource(context.Context, string) (K, error) ModifyKubernetesResource(context.Context, string) error // Comparing both CompareTeleportAndKubernetesResource(T, K) (bool, string) }
type TestOption ¶
type TestOption func(*TestSetup)
func WithTeleportClient ¶
func WithTeleportClient(clt *client.Client) TestOption
type TestSetup ¶
type TestSetup struct { TeleportClient *client.Client K8sClient kclient.Client K8sRestConfig *rest.Config Namespace *core.Namespace Operator manager.Manager OperatorCancel context.CancelFunc OperatorName string // contains filtered or unexported fields }
func SetupTestEnv ¶
func SetupTestEnv(t *testing.T, opts ...TestOption) *TestSetup
SetupTestEnv creates a Kubernetes server, a teleport server and starts the operator
func (*TestSetup) StartKubernetesOperator ¶
StartKubernetesOperator creates and start a new operator
func (*TestSetup) StopKubernetesOperator ¶
func (s *TestSetup) StopKubernetesOperator()