Update test utilities & build file
This commit is contained in:
@@ -717,9 +717,10 @@ func (cont *GCEIngressController) Init() {
|
||||
// invoking deleteStaticIPs.
|
||||
func (cont *GCEIngressController) CreateStaticIP(name string) string {
|
||||
gceCloud := cont.Cloud.Provider.(*gcecloud.GCECloud)
|
||||
ip, err := gceCloud.ReserveGlobalStaticIP(name, "")
|
||||
addr := &compute.Address{Name: name}
|
||||
ip, err := gceCloud.ReserveGlobalAddress(addr)
|
||||
if err != nil {
|
||||
if delErr := gceCloud.DeleteGlobalStaticIP(name); delErr != nil {
|
||||
if delErr := gceCloud.DeleteGlobalAddress(name); delErr != nil {
|
||||
if cont.isHTTPErrorCode(delErr, http.StatusNotFound) {
|
||||
Logf("Static ip with name %v was not allocated, nothing to delete", name)
|
||||
} else {
|
||||
|
||||
@@ -5167,20 +5167,15 @@ func CleanupGCEResources(loadBalancerName string) (retErr error) {
|
||||
!IsGoogleAPIHTTPErrorCode(err, http.StatusNotFound) {
|
||||
retErr = err
|
||||
}
|
||||
if err := gceCloud.DeleteForwardingRule(loadBalancerName); err != nil &&
|
||||
if err := gceCloud.DeleteRegionForwardingRule(loadBalancerName, gceCloud.Region()); err != nil &&
|
||||
!IsGoogleAPIHTTPErrorCode(err, http.StatusNotFound) {
|
||||
retErr = fmt.Errorf("%v\n%v", retErr, err)
|
||||
|
||||
}
|
||||
if err := gceCloud.DeleteGlobalStaticIP(loadBalancerName); err != nil &&
|
||||
if err := gceCloud.DeleteRegionAddress(loadBalancerName, gceCloud.Region()); err != nil &&
|
||||
!IsGoogleAPIHTTPErrorCode(err, http.StatusNotFound) {
|
||||
retErr = fmt.Errorf("%v\n%v", retErr, err)
|
||||
}
|
||||
// This function shells out to gcloud, so we can't compare for NotFound errors.
|
||||
// TODO: Invoke cloudprovider method directly instead.
|
||||
if err := DeleteGCEStaticIP(loadBalancerName); err != nil {
|
||||
Logf("%v", err)
|
||||
}
|
||||
var hcNames []string
|
||||
hc, getErr := gceCloud.GetHttpHealthCheck(loadBalancerName)
|
||||
if getErr != nil && !IsGoogleAPIHTTPErrorCode(getErr, http.StatusNotFound) {
|
||||
@@ -5190,7 +5185,7 @@ func CleanupGCEResources(loadBalancerName string) (retErr error) {
|
||||
if hc != nil {
|
||||
hcNames = append(hcNames, hc.Name)
|
||||
}
|
||||
if err := gceCloud.DeleteTargetPool(loadBalancerName, hcNames...); err != nil &&
|
||||
if err := gceCloud.DeleteExternalTargetPoolAndChecks(loadBalancerName, gceCloud.Region(), hcNames...); err != nil &&
|
||||
!IsGoogleAPIHTTPErrorCode(err, http.StatusNotFound) {
|
||||
retErr = fmt.Errorf("%v\n%v", retErr, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user