Parcourir la source

Fix tests

Signed-off-by: Sean Holcomb <seanholcomb@gmail.com>
Sean Holcomb il y a 1 semaine
Parent
commit
7a26c1e903
1 fichiers modifiés avec 42 ajouts et 3 suppressions
  1. 42 3
      modules/collector-source/pkg/scrape/clustercache_test.go

+ 42 - 3
modules/collector-source/pkg/scrape/clustercache_test.go

@@ -572,10 +572,22 @@ func Test_kubernetesScraper_scrapePods(t *testing.T) {
 						source.OwnerKindLabel:    "deployment",
 						source.OwnerKindLabel:    "deployment",
 						source.OwnerNameLabel:    "deployment1",
 						source.OwnerNameLabel:    "deployment1",
 						source.OwnerUIDLabel:     "",
 						source.OwnerUIDLabel:     "",
-						source.ContainerLabel:    "false",
+						source.ControllerLabel:   "false",
+					},
+					Value: 0,
+					AdditionalInfo: map[string]string{
+						source.UIDLabel:          "uuid1",
+						source.PodLabel:          "pod1",
+						source.NamespaceUIDLabel: "",
+						source.NodeUIDLabel:      "",
+						source.NamespaceLabel:    "namespace1",
+						source.NodeLabel:         "node1",
+						source.InstanceLabel:     "node1",
+						source.OwnerKindLabel:    "deployment",
+						source.OwnerNameLabel:    "deployment1",
+						source.OwnerUIDLabel:     "",
+						source.ControllerLabel:   "false",
 					},
 					},
-					Value:          0,
-					AdditionalInfo: nil,
 				},
 				},
 				{
 				{
 					Name: metric.KubePodContainerStatusRunning,
 					Name: metric.KubePodContainerStatusRunning,
@@ -1659,6 +1671,15 @@ func Test_kubernetesScraper_scrapeReplicaSets(t *testing.T) {
 						source.ControllerLabel: "false",
 						source.ControllerLabel: "false",
 					},
 					},
 					Value: 0,
 					Value: 0,
+					AdditionalInfo: map[string]string{
+						source.ReplicaSetLabel: "replicaSet1",
+						source.NamespaceLabel:  "namespace1",
+						source.UIDLabel:        "uuid1",
+						source.OwnerNameLabel:  "rollout1",
+						source.OwnerKindLabel:  "Rollout",
+						source.OwnerUIDLabel:   "",
+						source.ControllerLabel: "false",
+					},
 				},
 				},
 				// pureReplicaSet: info/labels/annotations
 				// pureReplicaSet: info/labels/annotations
 				{
 				{
@@ -1704,8 +1725,17 @@ func Test_kubernetesScraper_scrapeReplicaSets(t *testing.T) {
 						source.UIDLabel:        "uuid2",
 						source.UIDLabel:        "uuid2",
 						source.OwnerNameLabel:  source.NoneLabelValue,
 						source.OwnerNameLabel:  source.NoneLabelValue,
 						source.OwnerKindLabel:  source.NoneLabelValue,
 						source.OwnerKindLabel:  source.NoneLabelValue,
+						source.ControllerLabel: "false",
 					},
 					},
 					Value: 0,
 					Value: 0,
+					AdditionalInfo: map[string]string{
+						source.ReplicaSetLabel: "pureReplicaSet",
+						source.NamespaceLabel:  "namespace1",
+						source.UIDLabel:        "uuid2",
+						source.OwnerNameLabel:  source.NoneLabelValue,
+						source.OwnerKindLabel:  source.NoneLabelValue,
+						source.ControllerLabel: "false",
+					},
 				},
 				},
 			},
 			},
 		},
 		},
@@ -1770,8 +1800,17 @@ func Test_kubernetesScraper_scrapeReplicaSets(t *testing.T) {
 						source.UIDLabel:        "uuid1",
 						source.UIDLabel:        "uuid1",
 						source.OwnerNameLabel:  source.NoneLabelValue,
 						source.OwnerNameLabel:  source.NoneLabelValue,
 						source.OwnerKindLabel:  source.NoneLabelValue,
 						source.OwnerKindLabel:  source.NoneLabelValue,
+						source.ControllerLabel: "false",
 					},
 					},
 					Value: 0,
 					Value: 0,
+					AdditionalInfo: map[string]string{
+						source.ReplicaSetLabel: "replicaSet1",
+						source.NamespaceLabel:  "namespace1",
+						source.UIDLabel:        "uuid1",
+						source.OwnerNameLabel:  source.NoneLabelValue,
+						source.OwnerKindLabel:  source.NoneLabelValue,
+						source.ControllerLabel: "false",
+					},
 				},
 				},
 			},
 			},
 		},
 		},