Skip to content
This repository has been archived by the owner on Jun 29, 2022. It is now read-only.

Commit

Permalink
test/components/util: wait for DaemonSet and Deployment updates
Browse files Browse the repository at this point in the history
To support verifying that given DaemonSet or Deployment has been
updated, this commit adds extra condition for WaitForDaemonSet() and
WaitForDeployment() functions before converging and extends log format
to also include new information.

Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
  • Loading branch information
invidian committed Dec 1, 2020
1 parent a8f1832 commit 50dc307
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions test/components/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,10 @@ func WaitForDaemonSet(t *testing.T, client kubernetes.Interface, ns, name string
return false, nil
}

t.Logf("daemonset: %s, replicas: %d/%d", name, ds.Status.DesiredNumberScheduled, replicas)
if ds.Status.NumberReady == replicas {
t.Logf("daemonset: %s/%s, expected: %d desired: %d ready: %d updated: %d",
ns, name, replicas, ds.Status.DesiredNumberScheduled, ds.Status.NumberReady, ds.Status.UpdatedNumberScheduled)

if ds.Status.NumberReady == replicas && ds.Status.UpdatedNumberScheduled == replicas {
t.Logf("found required replicas")
return true, nil
}
Expand Down Expand Up @@ -213,9 +215,10 @@ func WaitForDeployment(t *testing.T, client kubernetes.Interface, ns, name strin
return false, nil
}

t.Logf("deployment: %s, replicas: %d/%d", name, int(deploy.Status.AvailableReplicas), replicas)
t.Logf("deployment: %s/%s, expected: %d desired: %d ready: %d updated: %d",
ns, name, replicas, deploy.Status.Replicas, deploy.Status.AvailableReplicas, deploy.Status.UpdatedReplicas)

if deploy.Status.AvailableReplicas == replicas {
if deploy.Status.AvailableReplicas == replicas && deploy.Status.UpdatedReplicas == replicas {
t.Logf("found required replicas")
return true, nil
}
Expand Down

0 comments on commit 50dc307

Please sign in to comment.