Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
NameHaibinZhang committed Nov 14, 2024
1 parent ecfd8cf commit 569f691
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion core/constants/TagConstants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "pod.labels";
const std::string DEFAULT_TRACE_TAG_LABELS = "k8s.pod.label";
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";
Expand Down
2 changes: 1 addition & 1 deletion core/metadata/LabelingK8sMetadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "models/SpanEvent.h"
#include "monitor/metric_constants/MetricConstants.h"
#include <boost/utility/string_view.hpp>
#include "K8sMetadata.h"


using logtail::StringView;

Expand Down
20 changes: 10 additions & 10 deletions core/unittest/metadata/K8sMetadataUnittest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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":"","k8s.pod.label":{"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;
Expand Down Expand Up @@ -67,7 +67,7 @@ class k8sMetadataUnittest : public ::testing::Test {
"workload.name": "coredns-7b669cbb96",
"workload.kind": "replicaset",
"service.name": "",
"labels": {
"k8s.pod.label": {
"k8s-app": "kube-dns",
"pod-template-hash": "7b669cbb96"
},
Expand All @@ -84,7 +84,7 @@ class k8sMetadataUnittest : public ::testing::Test {
"workload.name": "csi-provisioner-8bd988c55",
"workload.kind": "replicaset",
"service.name": "",
"labels": {
"k8s.pod.label": {
"app": "csi-provisioner",
"pod-template-hash": "8bd988c55"
},
Expand All @@ -111,7 +111,7 @@ class k8sMetadataUnittest : public ::testing::Test {
"workload.name": "kube-proxy-worker",
"workload.kind": "daemonset",
"service.name": "",
"labels": {
"k8s.pod.label": {
"controller-revision-hash": "756748b889",
"k8s-app": "kube-proxy-worker",
"pod-template-generation": "1"
Expand Down Expand Up @@ -187,7 +187,7 @@ class k8sMetadataUnittest : public ::testing::Test {
"workload.name": "coredns-7b669cbb96",
"workload.kind": "replicaset",
"service.name": "",
"labels": {
"k8s.pod.label": {
"k8s-app": "kube-dns",
"pod-template-hash": "7b669cbb96"
},
Expand All @@ -204,7 +204,7 @@ class k8sMetadataUnittest : public ::testing::Test {
"workload.name": "csi-provisioner-8bd988c55",
"workload.kind": "replicaset",
"service.name": "",
"labels": {
"k8s.pod.label": {
"app": "csi-provisioner",
"pod-template-hash": "8bd988c55"
},
Expand All @@ -231,7 +231,7 @@ class k8sMetadataUnittest : public ::testing::Test {
"workload.name": "kube-proxy-worker",
"workload.kind": "daemonset",
"service.name": "",
"labels": {
"k8s.pod.label": {
"controller-revision-hash": "756748b889",
"k8s-app": "kube-proxy-worker",
"pod-template-generation": "1"
Expand Down Expand Up @@ -301,7 +301,7 @@ class k8sMetadataUnittest : public ::testing::Test {
"workload.name": "coredns-7b669cbb96",
"workload.kind": "replicaset",
"service.name": "",
"labels": {
"k8s.pod.label": {
"k8s-app": "kube-dns",
"pod-template-hash": "7b669cbb96"
},
Expand All @@ -318,7 +318,7 @@ class k8sMetadataUnittest : public ::testing::Test {
"workload.name": "csi-provisioner-8bd988c55",
"workload.kind": "replicaset",
"service.name": "",
"labels": {
"k8s.pod.label": {
"app": "csi-provisioner",
"pod-template-hash": "8bd988c55"
},
Expand All @@ -345,7 +345,7 @@ class k8sMetadataUnittest : public ::testing::Test {
"workload.name": "kube-proxy-worker",
"workload.kind": "daemonset",
"service.name": "",
"labels": {
"k8s.pod.label": {
"controller-revision-hash": "756748b889",
"k8s-app": "kube-proxy-worker",
"pod-template-generation": "1"
Expand Down

0 comments on commit 569f691

Please sign in to comment.