Fix a bug in Delete() in storage/driver/cfgmaps.go (#7367)

pull/7777/head
tiendc 5 years ago committed by GitHub
parent 06bc18c624
commit 26830942d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -201,11 +201,6 @@ func (cfgmaps *ConfigMaps) Update(key string, rls *rspb.Release) error {
func (cfgmaps *ConfigMaps) Delete(key string) (rls *rspb.Release, err error) {
// fetch the release to check existence
if rls, err = cfgmaps.Get(key); err != nil {
if apierrors.IsNotFound(err) {
return nil, ErrReleaseExists
}
cfgmaps.Log("delete: failed to get release %q: %s", key, err)
return nil, err
}
// delete the release

@ -194,6 +194,12 @@ func TestConfigMapDelete(t *testing.T) {
cfgmaps := newTestFixtureCfgMaps(t, []*rspb.Release{rel}...)
// perform the delete on a non-existent release
_, err := cfgmaps.Delete("nonexistent")
if err != ErrReleaseNotFound {
t.Fatalf("Expected ErrReleaseNotFound: got {%v}", err)
}
// perform the delete
rls, err := cfgmaps.Delete(key)
if err != nil {

Loading…
Cancel
Save