Merge pull request #111721 from alculquicondor/fix-delete-expectations

Fix deleting UIDs tracking expectations
This commit is contained in:
Kubernetes Prow Robot 2022-08-05 12:07:25 -07:00 committed by GitHub
commit 137439194d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View File

@ -105,8 +105,11 @@ func (u *uidTrackingExpectations) finalizerRemovalObserved(jobKey, deleteKey str
// DeleteExpectations deletes the UID set.
func (u *uidTrackingExpectations) deleteExpectations(jobKey string) {
if err := u.store.Delete(jobKey); err != nil {
klog.ErrorS(err, "deleting tracking annotation UID expectations", "job", jobKey)
set := u.getSet(jobKey)
if set != nil {
if err := u.store.Delete(set); err != nil {
klog.ErrorS(err, "Could not delete tracking annotation UID expectations", "job", jobKey)
}
}
}

View File

@ -108,4 +108,11 @@ func TestUIDTrackingExpectations(t *testing.T) {
t.Errorf("Unexpected keys for job %s (-want,+got):\n%s", track.job, diff)
}
}
for _, track := range tracks {
expectations.deleteExpectations(track.job)
uids := expectations.getSet(track.job)
if uids != nil {
t.Errorf("Wanted expectations for job %s to be cleared, but they were not", track.job)
}
}
}