Updating FakeLoadBalancers.Delete to return NotFound when appropriate
@@ -159,6 +159,10 @@ func (f *FakeLoadBalancers) DeleteGlobalForwardingRule(name string) error {
fw = append(fw, f.Fw[i])
}
}
+ if len(f.Fw) == len(fw) {
+ // Nothing was deleted.
+ return utils.FakeGoogleAPINotFoundErr()
+ }
f.Fw = fw
return nil
}
@@ -218,6 +222,10 @@ func (f *FakeLoadBalancers) DeleteUrlMap(name string) error {
um = append(um, f.Um[i])
}
}
+ if len(f.Um) == len(um) {
+ // Nothing was deleted.
+ return utils.FakeGoogleAPINotFoundErr()
+ }
f.Um = um
return nil
}
@@ -258,6 +266,10 @@ func (f *FakeLoadBalancers) DeleteTargetHttpProxy(name string) error {
tp = append(tp, f.Tp[i])
}
}
+ if len(f.Tp) == len(tp) {
+ // Nothing was deleted.
+ return utils.FakeGoogleAPINotFoundErr()
+ }
f.Tp = tp
return nil
}
@@ -303,6 +315,10 @@ func (f *FakeLoadBalancers) DeleteTargetHttpsProxy(name string) error {
tp = append(tp, f.Tps[i])
}
}
+ if len(f.Tps) == len(tp) {
+ // Nothing was deleted.
+ return utils.FakeGoogleAPINotFoundErr()
+ }
f.Tps = tp
return nil
}
@@ -425,6 +441,10 @@ func (f *FakeLoadBalancers) DeleteGlobalAddress(name string) error {
ip = append(ip, f.IP[i])
}
}
+ if len(f.IP) == len(ip) {
+ // Nothing was deleted.
+ return utils.FakeGoogleAPINotFoundErr()
+ }
f.IP = ip
return nil
}
@@ -459,6 +479,10 @@ func (f *FakeLoadBalancers) DeleteSslCertificate(name string) error {
certs = append(certs, f.Certs[i])
}
}
+ if len(f.Certs) == len(certs) {
+ // Nothing was deleted.
+ return utils.FakeGoogleAPINotFoundErr()
+ }
f.Certs = certs
return nil
}
