Explorar o código

test fix

Signed-off-by: Sean Holcomb <seanholcomb@gmail.com>
Sean Holcomb hai 4 semanas
pai
achega
4bf489d5a8
Modificáronse 1 ficheiros con 7 adicións e 6 borrados
  1. 7 6
      modules/collector-source/pkg/scrape/clustercache_test.go

+ 7 - 6
modules/collector-source/pkg/scrape/clustercache_test.go

@@ -236,17 +236,17 @@ func Test_kubernetesScraper_scrapeDeployments(t *testing.T) {
 			// reflect the final state: {uid, namespace_uid, deployment, namespace}.
 			expected: []metric.Update{
 				{
-					Name: metric.DeploymentLabels,
+					Name: metric.DeploymentInfo,
 					Labels: map[string]string{
 						source.UIDLabel:          "uuid1",
-						source.NamespaceUIDLabel: "",
+						source.NamespaceUIDLabel: "ns-uuid1",
 						source.DeploymentLabel:   "deployment1",
 						source.NamespaceLabel:    "namespace1",
 					},
 					Value: 0,
 					AdditionalInfo: map[string]string{
 						source.UIDLabel:          "uuid1",
-						source.NamespaceUIDLabel: "",
+						source.NamespaceUIDLabel: "ns-uuid1",
 						source.DeploymentLabel:   "deployment1",
 						source.NamespaceLabel:    "namespace1",
 					},
@@ -255,7 +255,7 @@ func Test_kubernetesScraper_scrapeDeployments(t *testing.T) {
 					Name: metric.DeploymentLabels,
 					Labels: map[string]string{
 						source.UIDLabel:          "uuid1",
-						source.NamespaceUIDLabel: "",
+						source.NamespaceUIDLabel: "ns-uuid1",
 						source.DeploymentLabel:   "deployment1",
 						source.NamespaceLabel:    "namespace1",
 					},
@@ -266,7 +266,7 @@ func Test_kubernetesScraper_scrapeDeployments(t *testing.T) {
 					Name: metric.DeploymentAnnotations,
 					Labels: map[string]string{
 						source.UIDLabel:          "uuid1",
-						source.NamespaceUIDLabel: "",
+						source.NamespaceUIDLabel: "ns-uuid1",
 						source.DeploymentLabel:   "deployment1",
 						source.NamespaceLabel:    "namespace1",
 					},
@@ -277,7 +277,7 @@ func Test_kubernetesScraper_scrapeDeployments(t *testing.T) {
 					Name: metric.DeploymentMatchLabels,
 					Labels: map[string]string{
 						source.UIDLabel:          "uuid1",
-						source.NamespaceUIDLabel: "",
+						source.NamespaceUIDLabel: "ns-uuid1",
 						source.DeploymentLabel:   "deployment1",
 						source.NamespaceLabel:    "namespace1",
 					},
@@ -294,6 +294,7 @@ func Test_kubernetesScraper_scrapeDeployments(t *testing.T) {
 		t.Run(tt.name, func(t *testing.T) {
 			ks := &ClusterCacheScraper{}
 			nsIndex := newSyncMap[string, types.UID](0)
+			nsIndex.Set("namespace1", "ns-uuid1")
 			var scrapeResults []metric.Update
 			for _, s := range tt.scrapes {
 				res := ks.scrapeDeployments(s.Deployments, nsIndex)