Skip to content

Commit

Permalink
test(e2e): wait for deployment to exist in csv replacement test
Browse files Browse the repository at this point in the history
  • Loading branch information
ecordell committed Apr 29, 2019
1 parent 49ca4c5 commit 819cc9c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/e2e/csv_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,19 @@ func awaitCSV(t *testing.T, c versioned.Interface, namespace, name string, check
return fetched, err
}

func waitForDeployment(t *testing.T, c operatorclient.ClientInterface, name string) error {
return wait.Poll(pollInterval, pollDuration, func() (bool, error) {
_, err := c.GetDeployment(testNamespace, name)
if err != nil {
if k8serrors.IsNotFound(err) {
return false, nil
}
return false, err
}
return true, nil
})
}

func waitForDeploymentToDelete(t *testing.T, c operatorclient.ClientInterface, name string) error {
return wait.Poll(pollInterval, pollDuration, func() (bool, error) {
t.Logf("waiting for deployment %s to delete", name)
Expand Down Expand Up @@ -2687,6 +2700,10 @@ func TestUpdateCSVModifyDeploymentName(t *testing.T) {
_, err = crc.OperatorsV1alpha1().ClusterServiceVersions(testNamespace).Update(fetchedCSV)
require.NoError(t, err)

// Wait for new deployment to exist
err = waitForDeployment(t, c, strategyNew.DeploymentSpecs[0].Name)
require.NoError(t, err)

// Wait for updated CSV to succeed
_, err = fetchCSV(t, crc, csv.Name, testNamespace, csvSucceededChecker)
require.NoError(t, err)
Expand Down

0 comments on commit 819cc9c

Please sign in to comment.