Fix volume integration test flake

When we create a PV, we should created it withoud Spec.ClaimRef.UID.

In rare cases, when 'PV added' event with UID is processed before 'PVC
added' (created by for loop few lines above), the controller does not know
a PVC with this UID and considers the PV as released. Reclaim policy is
then executed and the PV is deleted and it's never bound.


With UID="", the controller waits for the PVC to get created and binds
it.
This commit is contained in:
Jan Safranek 2016-06-06 14:37:21 +02:00
parent acc2d22765
commit 51c218ea7d

View File

@ -242,6 +242,7 @@ func TestPersistentVolumeBindRace(t *testing.T) {
t.Fatalf("Unexpected error getting claimRef: %v", err)
}
pv.Spec.ClaimRef = claimRef
pv.Spec.ClaimRef.UID = ""
pv, err = testClient.PersistentVolumes().Create(pv)
if err != nil {