Skip to content

Commit

Permalink
Add test to check binding owner reference is not controller reference
Browse files Browse the repository at this point in the history
Signed-off-by: John Starich <[email protected]>
  • Loading branch information
JohnStarich committed Aug 5, 2021
1 parent df13703 commit dc3a9a2
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions controllers/binding_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,22 @@ func TestBinding(t *testing.T) {

// check binding is online
require.Eventually(t, verifyStatus(ctx, t, binding.ObjectMeta, new(ibmcloudv1.Binding), bindingStateOnline), defaultWait, defaultTick)
{ // check binding owner reference
var newBinding ibmcloudv1.Binding
require.NoError(t, getObject(ctx, binding.ObjectMeta, &newBinding))
for i := range newBinding.OwnerReferences {
newBinding.OwnerReferences[i].UID = ""
}
assert.Equal(t, []metav1.OwnerReference{
{
APIVersion: "ibmcloud.ibm.com/v1",
Kind: "Service",
Name: "test-translator-2",
Controller: nil, // controller must be nil. See https://github.com/IBM/cloud-operators/issues/222
BlockOwnerDeletion: nil,
},
}, newBinding.OwnerReferences)
}

// check secret is created
err = getObject(ctx, binding.ObjectMeta, &corev1.Secret{})
Expand Down

0 comments on commit dc3a9a2

Please sign in to comment.