Merge pull request #103252 from pacoxu/defer-fix

custom-metrics: do cleanup even if the creation is not full succeed
This commit is contained in:
Kubernetes Prow Robot
2022-01-06 12:50:00 -08:00
committed by GitHub

View File

@@ -264,10 +264,10 @@ func (tc *CustomMetricTestCase) Run() {
defer monitoring.CleanupDescriptors(gcmService, projectID) defer monitoring.CleanupDescriptors(gcmService, projectID)
err = monitoring.CreateAdapter(monitoring.AdapterDefault) err = monitoring.CreateAdapter(monitoring.AdapterDefault)
defer monitoring.CleanupAdapter(monitoring.AdapterDefault)
if err != nil { if err != nil {
framework.Failf("Failed to set up: %v", err) framework.Failf("Failed to set up: %v", err)
} }
defer monitoring.CleanupAdapter(monitoring.AdapterDefault)
// Run application that exports the metric // Run application that exports the metric
err = createDeploymentToScale(tc.framework, tc.kubeClient, tc.deployment, tc.pod) err = createDeploymentToScale(tc.framework, tc.kubeClient, tc.deployment, tc.pod)