helper func for deploys expected to fail
@@ -206,6 +206,10 @@ func removeString(slice []string, s string) []string {
// EnsureInstance creates the instance and waits for it to exist or timeout
func EnsureInstance(ctx context.Context, t *testing.T, tc TestContext, instance runtime.Object) {
+ EnsureInstanceWithResult(ctx, t, tc, instance, successMsg, true)
+}
+
+func EnsureInstanceWithResult(ctx context.Context, t *testing.T, tc TestContext, instance runtime.Object, message string, provisioned bool) {
assert := assert.New(t)
typeOf := fmt.Sprintf("%T", instance)
@@ -226,7 +230,7 @@ func EnsureInstance(ctx context.Context, t *testing.T, tc TestContext, instance
assert.Eventually(func() bool {
_ = tc.k8sClient.Get(ctx, names, instance)
statused := ConvertToStatus(instance)
- return strings.Contains(statused.Status.Message, successMsg) && statused.Status.Provisioned == true
+ return strings.Contains(statused.Status.Message, message) && statused.Status.Provisioned == provisioned
}, tc.timeout, tc.retry, fmt.Sprintf("wait for %s to provision", typeOf))
}
