testutil

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildMatchersFromExpected

func BuildMatchersFromExpected(ipLists []project.IPAccessList) []types.GomegaMatcher

func CheckCondition

func CheckCondition(k8sClient client.Client, createdResource mdbv1.AtlasCustomResource, expectedCondition status.Condition, checksIfFail ...func(mdbv1.AtlasCustomResource)) bool

func EventExists

func EventExists(k8sClient client.Client, createdResource mdbv1.AtlasCustomResource, expectedType, expectedReason, expectedMessageRegexp string)

func FindConditionByType

func FindConditionByType(conditions []status.Condition, conditionType status.ConditionType) (status.Condition, bool)

func MatchCondition

func MatchCondition(expected status.Condition) types.GomegaMatcher

MatchCondition returns the GomegaMatcher that checks if the 'actual' status.Condition matches the 'expected' one.

func MatchConditions

func MatchConditions(expected ...status.Condition) []types.GomegaMatcher

MatchConditions is a convenience method that allows to create the range of matchers simplifying testing

func MatchIPAccessList

func MatchIPAccessList(expected project.IPAccessList) types.GomegaMatcher

MatchIPAccessList returns the GomegaMatcher that checks if the 'actual' mongodbatlas.ProjectIPAccessList matches the 'expected' mdbv1.ProjectIPAccessList one. Note, that we cannot compare them by all the fields as Atlas tends to set default fields after IPAccessList creation so we need to compare only the fields that the Operator has set

func MatchMaintenanceWindow

func MatchMaintenanceWindow(expected project.MaintenanceWindow) types.GomegaMatcher

MatchMaintenanceWindow returns the GomegaMatcher that checks if the 'actual' mongodbatlas.MaintenanceWindow matches the 'expected' mdbv1.MaintenanceWindow one. Note, that we cannot compare them by all the fields as Atlas tends to set default fields after MaintenanceWindow requests execution so we need to compare only the fields that remain in the same state

func ReadAtlasResource

func ReadAtlasResource(k8sClient client.Client, createdResource mdbv1.AtlasCustomResource) bool

func WaitForAtlasDatabaseUserStateToNotBeReached

func WaitForAtlasDatabaseUserStateToNotBeReached(ctx context.Context, atlasClient *mongodbatlas.Client, authDb, groupId, userName string, fns ...func(user *mongodbatlas.DatabaseUser) bool) func() bool

WaitForAtlasDatabaseUserStateToNotBeReached periodically checks the given atlas database user for a given condition. The function returns true after the given context timeout is exceeded.

func WaitForAtlasDeploymentStateToNotBeReached

func WaitForAtlasDeploymentStateToNotBeReached(ctx context.Context, atlasClient *mongodbatlas.Client, projectName, deploymentName string, fns ...func(*mongodbatlas.AdvancedCluster) bool) func() bool

WaitForAtlasDeploymentStateToNotBeReached periodically checks the given atlas deployment for a given condition. The function returns true after the given context timeout is exceeded.

func WaitForAtlasProjectStateToNotBeReached

func WaitForAtlasProjectStateToNotBeReached(ctx context.Context, atlasClient *mongodbatlas.Client, projectName string, fns ...func(project *mongodbatlas.Project) bool) func() bool

WaitForAtlasProjectStateToNotBeReached periodically checks the given atlas project for a given condition. The function returns true after the given context timeout is exceeded.

Types

This section is empty.

Jump to

Keyboard shortcuts

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