From 6df8f9100f6efccba120ae7cfbac20d7caddeae2 Mon Sep 17 00:00:00 2001 From: Youn Jae Kim Date: Tue, 27 Sep 2022 17:09:19 -0700 Subject: [PATCH] Removing deprecated util file --- test/e2e/utils/work_api_test_utils.go | 76 --------------------------- 1 file changed, 76 deletions(-) delete mode 100644 test/e2e/utils/work_api_test_utils.go diff --git a/test/e2e/utils/work_api_test_utils.go b/test/e2e/utils/work_api_test_utils.go deleted file mode 100644 index 2405bee5f..000000000 --- a/test/e2e/utils/work_api_test_utils.go +++ /dev/null @@ -1,76 +0,0 @@ -/* -Copyright (c) Microsoft Corporation. -Licensed under the MIT license. -*/ - -package utils - -import ( - "context" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/types" - workapi "sigs.k8s.io/work-api/pkg/apis/v1alpha1" - - "go.goms.io/fleet/test/e2e/framework" -) - -// Deprecated: The functions in this file will be removed or moved to helper.go. - -type ManifestDetails struct { - Manifest workapi.Manifest - GVK *schema.GroupVersionKind - GVR *schema.GroupVersionResource - ObjMeta metav1.ObjectMeta -} - -func CreateWorkObj(workName string, workNamespace string, manifestDetails []ManifestDetails) *workapi.Work { - work := &workapi.Work{ - ObjectMeta: metav1.ObjectMeta{ - Name: workName, - Namespace: workNamespace, - }, - } - - for _, detail := range manifestDetails { - work.Spec.Workload.Manifests = append(work.Spec.Workload.Manifests, detail.Manifest) - } - - return work -} - -func CreateWorkOld(work *workapi.Work, hubCluster *framework.Cluster) error { - return hubCluster.KubeClient.Create(context.Background(), work) -} - -func DecodeUnstructured(manifest workapi.Manifest) (*unstructured.Unstructured, error) { - unstructuredObj := &unstructured.Unstructured{} - err := unstructuredObj.UnmarshalJSON(manifest.Raw) - - return unstructuredObj, err -} - -func DeleteWorkResource(work *workapi.Work, hubCluster *framework.Cluster) error { - return hubCluster.KubeClient.Delete(context.Background(), work) -} - -func RetrieveAppliedWork(appliedWorkName string, memberCluster *framework.Cluster) (*workapi.AppliedWork, error) { - retrievedAppliedWork := workapi.AppliedWork{} - err := memberCluster.KubeClient.Get(context.Background(), types.NamespacedName{Name: appliedWorkName}, &retrievedAppliedWork) - if err != nil { - return &retrievedAppliedWork, err - } - - return &retrievedAppliedWork, nil -} - -func RetrieveWork(workNamespace string, workName string, hubCluster *framework.Cluster) (*workapi.Work, error) { - workRetrieved := workapi.Work{} - err := hubCluster.KubeClient.Get(context.Background(), types.NamespacedName{Namespace: workNamespace, Name: workName}, &workRetrieved) - if err != nil { - return nil, err - } - return &workRetrieved, nil -}