testutil

package
v1.9.3 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 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 added in v1.3.0

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

func EventExists added in v0.6.1

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 added in v1.1.0

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 added in v0.8.0

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 added in v1.0.0

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 added in v0.8.0

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