From c628cf88096964b4af3f44fa7a868c317c65d5f5 Mon Sep 17 00:00:00 2001 From: CeerDecy <1748788674@qq.com> Date: Wed, 7 Aug 2024 14:10:43 +0800 Subject: [PATCH] feat: pass test coverage --- .../plugins/k8s/instanceinfosync/pod_test.go | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 internal/tools/orchestrator/scheduler/executor/plugins/k8s/instanceinfosync/pod_test.go diff --git a/internal/tools/orchestrator/scheduler/executor/plugins/k8s/instanceinfosync/pod_test.go b/internal/tools/orchestrator/scheduler/executor/plugins/k8s/instanceinfosync/pod_test.go new file mode 100644 index 00000000000..9946348a3a8 --- /dev/null +++ b/internal/tools/orchestrator/scheduler/executor/plugins/k8s/instanceinfosync/pod_test.go @@ -0,0 +1,33 @@ +package instanceinfosync + +import ( + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "testing" +) + +func Test_extractEnvs(t *testing.T) { + pod := v1.Pod{ + Spec: v1.PodSpec{ + Containers: []v1.Container{}, + }, + ObjectMeta: metav1.ObjectMeta{ + Labels: map[string]string{ + "addon.erda.cloud/id": "10001", + "core.erda.cloud/cluster-name": "erda-jicheng", + "core.erda.cloud/org-name": "development-erda", + "core.erda.cloud/org-id": "888", + "core.erda.cloud/project-name": "Master", + "core.erda.cloud/project-id": "8888", + "core.erda.cloud/app-name": "go-demo", + "core.erda.cloud/app-id": "88888", + "core.erda.cloud/runtime-id": "66666", + "core.erda.cloud/service-name": "go-demo-web", + "core.erda.cloud/workspace": "prod", + "addon.erda.cloud/type": "mysql", + }, + }, + } + + extractEnvs(pod) +}