Skip to content

Commit

Permalink
Merge pull request #111721 from alculquicondor/fix-delete-expectations
Browse files Browse the repository at this point in the history
Fix deleting UIDs tracking expectations
  • Loading branch information
k8s-ci-robot committed Aug 5, 2022
2 parents 11d4cb5 + c1e0dac commit 1374391
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/controller/job/tracking_utils.go
Expand Up @@ -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)
}
}
}

Expand Down
7 changes: 7 additions & 0 deletions pkg/controller/job/tracking_utils_test.go
Expand Up @@ -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)
}
}
}

0 comments on commit 1374391

Please sign in to comment.