Update e2e tests to pipe in clusterID for gce resource cleanup

This commit is contained in:
Zihong Zheng
2017-06-23 15:56:12 -07:00
parent baca8a1490
commit be6bb318aa
4 changed files with 14 additions and 9 deletions

View File

@@ -5124,7 +5124,7 @@ func (p *E2ETestNodePreparer) CleanupNodes() error {
// CleanupGCEResources cleans up GCE Service Type=LoadBalancer resources with
// the given name. The name is usually the UUID of the Service prefixed with an
// alpha-numeric character ('a') to work around cloudprovider rules.
func CleanupGCEResources(loadBalancerName, zone string) (retErr error) {
func CleanupGCEResources(c clientset.Interface, loadBalancerName, zone string) (retErr error) {
gceCloud, err := GetGCECloud()
if err != nil {
return err
@@ -5155,7 +5155,12 @@ func CleanupGCEResources(loadBalancerName, zone string) (retErr error) {
if hc != nil {
hcNames = append(hcNames, hc.Name)
}
if err := gceCloud.DeleteExternalTargetPoolAndChecks(loadBalancerName, region, hcNames...); err != nil &&
clusterID, err := GetClusterID(c)
if err != nil {
retErr = fmt.Errorf("%v\n%v", retErr, err)
return
}
if err := gceCloud.DeleteExternalTargetPoolAndChecks(loadBalancerName, region, clusterID, hcNames...); err != nil &&
!IsGoogleAPIHTTPErrorCode(err, http.StatusNotFound) {
retErr = fmt.Errorf("%v\n%v", retErr, err)
}