MCPcopy Create free account
hub / github.com/cloudnative-pg/cloudnative-pg / WaitForReady

Function WaitForReady

tests/utils/deployments/deployment.go:62–91  ·  view source on GitHub ↗

WaitForReady waits for a Deployment to be ready

(
	ctx context.Context,
	crudClient client.Client,
	deployment *appsv1.Deployment,
	timeoutSeconds uint,
)

Source from the content-addressed store, hash-verified

60
61// WaitForReady waits for a Deployment to be ready
62func WaitForReady(
63 ctx context.Context,
64 crudClient client.Client,
65 deployment *appsv1.Deployment,
66 timeoutSeconds uint,
67) error {
68 err := retry.New(
69 retry.Attempts(timeoutSeconds),
70 retry.Delay(time.Second),
71 retry.DelayType(retry.FixedDelay)).
72 Do(
73 func() error {
74 if err := crudClient.Get(ctx, client.ObjectKey{
75 Namespace: deployment.Namespace,
76 Name: deployment.Name,
77 }, deployment); err != nil {
78 return err
79 }
80 if !IsReady(*deployment) {
81 return fmt.Errorf(
82 "deployment not ready. Namespace: %v, Name: %v",
83 deployment.Namespace,
84 deployment.Name,
85 )
86 }
87 return nil
88 },
89 )
90 return err
91}

Callers 5

InstallAzuriteFunction · 0.92
DeployFunction · 0.92
AssertFastFailOverFunction · 0.92
assertFastSwitchoverFunction · 0.92

Calls 2

IsReadyFunction · 0.70
GetMethod · 0.45

Tested by 1

assertFastSwitchoverFunction · 0.74