DRA: test mismatched claim UIDs

This commit is contained in:
Ed Bartosh
2025-05-06 13:24:40 +03:00
parent 96da66054d
commit 8d8fd92966

View File

@@ -388,6 +388,7 @@ func getFakeNode() (*v1.Node, error) {
func TestPrepareResources(t *testing.T) {
claimName := claimName
fakeKubeClient := fake.NewSimpleClientset()
anotherClaimUID := types.UID("another-claim-uid")
for _, test := range []struct {
description string
@@ -546,6 +547,14 @@ func TestPrepareResources(t *testing.T) {
},
}},
},
{
description: "claim UIDs mismatch",
driverName: driverName,
pod: genTestPod(),
claim: genTestClaim(claimName, driverName, deviceName, podUID),
claimInfo: genTestClaimInfo(anotherClaimUID, []string{podUID}, false),
expectedErrMsg: fmt.Sprintf("old claim with same name %s/%s and different UID %s still exists", namespace, claimName, anotherClaimUID),
},
} {
t.Run(test.description, func(t *testing.T) {
tCtx := ktesting.Init(t)