From 44e1a47116b6f7ee4ea4130e03f3cb97c4df4a2a Mon Sep 17 00:00:00 2001 From: zhb192729 Date: Thu, 14 Nov 2024 11:49:31 +0800 Subject: [PATCH] update test --- core/constants/TagConstants.cpp | 2 +- .../unittest/metadata/K8sMetadataUnittest.cpp | 20 +++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/core/constants/TagConstants.cpp b/core/constants/TagConstants.cpp index 5979e7ca73..b280f85187 100644 --- a/core/constants/TagConstants.cpp +++ b/core/constants/TagConstants.cpp @@ -67,7 +67,7 @@ namespace logtail { const std::string DEFAULT_TRACE_TAG_PEER_NAMESPACE = "peer.namespace"; const std::string DEFAULT_TRACE_TAG_APPID = DEFAULT_TRACE_TAG_PID; const std::string DEFAULT_TRACE_TAG_IMAGES = "container.image.name"; - const std::string DEFAULT_TRACE_TAG_LABELS = "labels"; + const std::string DEFAULT_TRACE_TAG_LABELS = "pod.labels"; const std::string DEFAULT_TRACE_TAG_WORKLOAD_KIND = "workload.kind"; const std::string DEFAULT_TRACE_TAG_WORKLOAD_NAME = "workload.name"; const std::string DEFAULT_TRACE_TAG_SERVICENAME = "service.name"; diff --git a/core/unittest/metadata/K8sMetadataUnittest.cpp b/core/unittest/metadata/K8sMetadataUnittest.cpp index 6fcacc4974..68e7805b18 100644 --- a/core/unittest/metadata/K8sMetadataUnittest.cpp +++ b/core/unittest/metadata/K8sMetadataUnittest.cpp @@ -36,7 +36,7 @@ class k8sMetadataUnittest : public ::testing::Test { public: void TestGetByContainerIds() { LOG_INFO(sLogger, ("TestGetByContainerIds() begin", time(NULL))); - const std::string jsonData = R"({"containerd://286effd2650c0689b779018e42e9ec7aa3d2cb843005e038204e85fc3d4f9144":{"k8s.namespace.name":"default","workload.name":"oneagent-demo-658648895b","workload.kind":"replicaset","service.name":"","labels":{"app":"oneagent-demo","pod-template-hash":"658648895b"},"envs":{},"container.image.name":{"oneagent-demo":"sls-opensource-registry.cn-shanghai.cr.aliyuncs.com/ilogtail-community-edition/centos7-cve-fix:1.0.0"}}})"; + const std::string jsonData = R"({"containerd://286effd2650c0689b779018e42e9ec7aa3d2cb843005e038204e85fc3d4f9144":{"k8s.namespace.name":"default","workload.name":"oneagent-demo-658648895b","workload.kind":"replicaset","service.name":"","pod.labels":{"app":"oneagent-demo","pod-template-hash":"658648895b"},"envs":{},"container.image.name":{"oneagent-demo":"sls-opensource-registry.cn-shanghai.cr.aliyuncs.com/ilogtail-community-edition/centos7-cve-fix:1.0.0"}}})"; Json::Value root; Json::CharReaderBuilder readerBuilder; @@ -67,7 +67,7 @@ class k8sMetadataUnittest : public ::testing::Test { "workload.name": "coredns-7b669cbb96", "workload.kind": "replicaset", "service.name": "", - "labels": { + "pod.labels": { "k8s-app": "kube-dns", "pod-template-hash": "7b669cbb96" }, @@ -84,7 +84,7 @@ class k8sMetadataUnittest : public ::testing::Test { "workload.name": "csi-provisioner-8bd988c55", "workload.kind": "replicaset", "service.name": "", - "labels": { + "pod.labels": { "app": "csi-provisioner", "pod-template-hash": "8bd988c55" }, @@ -111,7 +111,7 @@ class k8sMetadataUnittest : public ::testing::Test { "workload.name": "kube-proxy-worker", "workload.kind": "daemonset", "service.name": "", - "labels": { + "pod.labels": { "controller-revision-hash": "756748b889", "k8s-app": "kube-proxy-worker", "pod-template-generation": "1" @@ -187,7 +187,7 @@ class k8sMetadataUnittest : public ::testing::Test { "workload.name": "coredns-7b669cbb96", "workload.kind": "replicaset", "service.name": "", - "labels": { + "pod.labels": { "k8s-app": "kube-dns", "pod-template-hash": "7b669cbb96" }, @@ -204,7 +204,7 @@ class k8sMetadataUnittest : public ::testing::Test { "workload.name": "csi-provisioner-8bd988c55", "workload.kind": "replicaset", "service.name": "", - "labels": { + "pod.labels": { "app": "csi-provisioner", "pod-template-hash": "8bd988c55" }, @@ -231,7 +231,7 @@ class k8sMetadataUnittest : public ::testing::Test { "workload.name": "kube-proxy-worker", "workload.kind": "daemonset", "service.name": "", - "labels": { + "pod.labels": { "controller-revision-hash": "756748b889", "k8s-app": "kube-proxy-worker", "pod-template-generation": "1" @@ -301,7 +301,7 @@ class k8sMetadataUnittest : public ::testing::Test { "workloadName": "coredns-7b669cbb96", "workloadKind": "replicaset", "service.name": "", - "labels": { + "pod.labels": { "k8s-app": "kube-dns", "pod-template-hash": "7b669cbb96" }, @@ -318,7 +318,7 @@ class k8sMetadataUnittest : public ::testing::Test { "workloadName": "csi-provisioner-8bd988c55", "workloadKind": "replicaset", "service.name": "", - "labels": { + "pod.labels": { "app": "csi-provisioner", "pod-template-hash": "8bd988c55" }, @@ -345,7 +345,7 @@ class k8sMetadataUnittest : public ::testing::Test { "workloadName": "kube-proxy-worker", "workloadKind": "daemonset", "service.name": "", - "labels": { + "pod.labels": { "controller-revision-hash": "756748b889", "k8s-app": "kube-proxy-worker", "pod-template-generation": "1"