@@ -340,50 +340,6 @@ var _ = g.Describe("[sig-cli] oc adm must-gather", func() {
340340 })
341341 })
342342 })
343-
344- g .It ("runs successfully for metrics gathering [apigroup:config.openshift.io]" , func () {
345- tempDir , err := os .MkdirTemp ("" , "test.oc-adm-must-gather." )
346- o .Expect (err ).NotTo (o .HaveOccurred ())
347- defer os .RemoveAll (tempDir )
348-
349- args := []string {
350- "--dest-dir" , tempDir ,
351- "--" ,
352- "/usr/bin/gather_metrics" ,
353- fmt .Sprintf ("--min-time=%d" , time .Now ().Add (- 5 * time .Minute ).UnixMilli ()),
354- fmt .Sprintf ("--max-time=%d" , time .Now ().UnixMilli ()),
355- "--match=prometheus_ready" ,
356- "--match=prometheus_build_info" ,
357- }
358- o .Expect (oc .Run ("adm" , "must-gather" ).Args (args ... ).Execute ()).To (o .Succeed ())
359-
360- // wait for the contents to show up in the plugin output directory
361- time .Sleep (5 * time .Second )
362-
363- pluginOutputDir := GetPluginOutputDir (tempDir )
364- metricsFile := path .Join (pluginOutputDir , "monitoring" , "metrics" , "metrics.openmetrics" )
365- errorFile := path .Join (pluginOutputDir , "monitoring" , "metrics" , "metrics.stderr" )
366-
367- // The error file should be empty
368- o .Expect (errorFile ).To (o .BeAnExistingFile ())
369- errorContent , err := os .ReadFile (errorFile )
370- o .Expect (err ).NotTo (o .HaveOccurred ())
371- o .Expect (errorContent ).To (o .BeEmpty ())
372-
373- // The metrics file should contain some series with a given format
374- o .Expect (metricsFile ).To (o .BeAnExistingFile ())
375- metrics , err := os .ReadFile (metricsFile )
376- o .Expect (err ).NotTo (o .HaveOccurred ())
377-
378- lines := strings .Split (strings .TrimSpace (string (metrics )), "\n " )
379- count := len (lines )
380- o .Expect (count ).To (o .BeNumerically (">=" , 5 ))
381- for _ , line := range lines [:count - 1 ] {
382- o .Expect (line ).To (o .MatchRegexp (`^(prometheus_ready|prometheus_build_info)\{.*\} \d+ \d+` ))
383- }
384-
385- o .Expect (lines [count - 1 ]).To (o .Equal ("# EOF" ))
386- })
387343})
388344
389345// GetPluginOutputDir returns the directory containing must-gather assets.
0 commit comments