delete test resource after the test done
@@ -175,6 +175,11 @@ var _ = Describe("ReplicaSchedulingPreferences", func() {
if err != nil {
tl.Fatalf("Failed waiting for matching overrides: %v", err)
}
+
+ err = deleteTestObj(typeConfig, kubeConfig, name, namespace)
+ if err != nil {
+ tl.Fatalf("Deletion of test object failed in fedeartion: %v", err)
+ }
})
}
})
@@ -243,6 +248,21 @@ func createTestObjs(tl common.TestLogger, fedClient clientset.Interface, typeCon
return name, nil
}
+func deleteTestObj(typeConfig typeconfig.Interface, kubeConfig *restclient.Config, name, namespace string) error {
+ templateAPIResource := typeConfig.GetTemplate()
+ templateClient, err := util.NewResourceClient(kubeConfig, &templateAPIResource)
+ if err != nil {
+ return err
+ }
+
+ err = templateClient.Resources(namespace).Delete(name, &metav1.DeleteOptions{})
+ if err != nil {
+ return err
+ }
+
+ return nil
+}
+
func waitForMatchingPlacement(tl common.TestLogger, typeConfig typeconfig.Interface, kubeConfig *restclient.Config, name, namespace string, expected map[string]int32) error {
placementAPIResource := typeConfig.GetPlacement()
placementKind := placementAPIResource.Kind
