@@ -87,7 +87,7 @@ var _ = Describe("Fleet dump", Label("sharding"), func() {
8787 continue
8888 }
8989
90- Expect (fileName ).To (HaveLen (2 ) )
90+ Expect (fileName ).To (HaveLen (3 ), "metrics file name should have format metrics_<namespace>_<servicename>" )
9191 Expect (content ).ToNot (BeEmpty ())
9292
9393 // Run a few basic checks on expected strings, checking full contents would be cumbersome
@@ -97,11 +97,12 @@ var _ = Describe("Fleet dump", Label("sharding"), func() {
9797 Expect (c ).To (ContainSubstring ("controller_runtime_reconcile_total" ))
9898
9999 exampleMonitoredRsc := "bundle"
100- if strings .Contains (fileName [1 ], "gitjob" ) {
100+ if strings .Contains (fileName [2 ], "gitjob" ) {
101101 exampleMonitoredRsc = "gitrepo"
102- } else if ! strings .Contains (fileName [1 ], "shard" ) {
102+ } else if ! strings .Contains (fileName [2 ], "shard" ) {
103103 // Check for fleet_*_desired_ready metrics on non-sharded services
104- Expect (c ).To (ContainSubstring (fmt .Sprintf ("fleet_%s_desired_ready" , exampleMonitoredRsc )))
104+ expectedStr := fmt .Sprintf ("fleet_%s_desired_ready" , exampleMonitoredRsc )
105+ Expect (c ).To (ContainSubstring (expectedStr ), fmt .Sprintf ("expected file %q to contain %q" , header .Name , expectedStr ))
105106 }
106107
107108 Expect (c ).To (ContainSubstring (fmt .Sprintf (`workqueue_work_duration_seconds_bucket{controller="%s",name="%s",` , exampleMonitoredRsc , exampleMonitoredRsc )))
@@ -110,14 +111,14 @@ var _ = Describe("Fleet dump", Label("sharding"), func() {
110111 }
111112
112113 Expect (foundFiles ).To (HaveLen (8 ))
113- Expect (foundFiles ).To (ContainElement ("metrics_monitoring -gitjob" ))
114- Expect (foundFiles ).To (ContainElement ("metrics_monitoring -gitjob-shard-shard0" ))
115- Expect (foundFiles ).To (ContainElement ("metrics_monitoring -gitjob-shard-shard1" ))
116- Expect (foundFiles ).To (ContainElement ("metrics_monitoring -gitjob-shard-shard2" ))
117- Expect (foundFiles ).To (ContainElement ("metrics_monitoring -fleet-controller" ))
118- Expect (foundFiles ).To (ContainElement ("metrics_monitoring -fleet-controller-shard-shard0" ))
119- Expect (foundFiles ).To (ContainElement ("metrics_monitoring -fleet-controller-shard-shard1" ))
120- Expect (foundFiles ).To (ContainElement ("metrics_monitoring -fleet-controller-shard-shard2" ))
114+ Expect (foundFiles ).To (ContainElement ("metrics_cattle-fleet-system_monitoring -gitjob" ))
115+ Expect (foundFiles ).To (ContainElement ("metrics_cattle-fleet-system_monitoring -gitjob-shard-shard0" ))
116+ Expect (foundFiles ).To (ContainElement ("metrics_cattle-fleet-system_monitoring -gitjob-shard-shard1" ))
117+ Expect (foundFiles ).To (ContainElement ("metrics_cattle-fleet-system_monitoring -gitjob-shard-shard2" ))
118+ Expect (foundFiles ).To (ContainElement ("metrics_cattle-fleet-system_monitoring -fleet-controller" ))
119+ Expect (foundFiles ).To (ContainElement ("metrics_cattle-fleet-system_monitoring -fleet-controller-shard-shard0" ))
120+ Expect (foundFiles ).To (ContainElement ("metrics_cattle-fleet-system_monitoring -fleet-controller-shard-shard1" ))
121+ Expect (foundFiles ).To (ContainElement ("metrics_cattle-fleet-system_monitoring -fleet-controller-shard-shard2" ))
121122 })
122123 })
123124
0 commit comments