@@ -379,6 +379,64 @@ func (s *CollectorSuite) TestIndividualFiles() {
379379 return strings .Join (result , "" )
380380 },
381381 },
382+ {
383+ namespace : "pgv2" ,
384+ // If the tool collects pgBackRest execution log files for pgv2
385+ name : "pgv2_pgbackrest_log_list" ,
386+ // tar -tf cluster-dump.tar.gz --wildcards 'cluster-dump/*/*/pgbackrest_log/*'
387+ cmd : []string {"tar" , "-tf" , "cluster-dump.tar.gz" , "--wildcards" , "cluster-dump/*/*/pgbackrest_log/*" },
388+ want : []string {"db-archive-push-async.log" , "db-stanza-create.log" },
389+ preprocessor : func (in string ) string {
390+ required := map [string ]struct {}{
391+ "db-archive-push-async.log" : {},
392+ "db-stanza-create.log" : {},
393+ }
394+
395+ files := strings .Split (in , "\n " )
396+ var result []string
397+ for _ , f := range files {
398+ b := path .Base (f )
399+ if _ , ok := required [b ]; ! ok {
400+ continue
401+ }
402+
403+ if ! slices .Contains (result , b ) {
404+ result = append (result , b )
405+ }
406+ }
407+ slices .Sort (result )
408+ return strings .Join (result , "\n " )
409+ },
410+ },
411+ {
412+ namespace : "pgv2" ,
413+ // If the tool collects tool command outputs (patronictl list, pgbackrest info) for pgv2
414+ name : "pgv2_tools_log_list" ,
415+ // tar -tf cluster-dump.tar.gz --wildcards 'cluster-dump/*/*/*'
416+ cmd : []string {"tar" , "-tf" , "cluster-dump.tar.gz" , "--wildcards" , "cluster-dump/*/*/*" },
417+ want : []string {"patronictl-list.log" , "pgbackrest-info.log" },
418+ preprocessor : func (in string ) string {
419+ required := map [string ]struct {}{
420+ "patronictl-list.log" : {},
421+ "pgbackrest-info.log" : {},
422+ }
423+
424+ files := strings .Split (in , "\n " )
425+ var result []string
426+ for _ , f := range files {
427+ b := path .Base (f )
428+ if _ , ok := required [b ]; ! ok {
429+ continue
430+ }
431+
432+ if ! slices .Contains (result , b ) {
433+ result = append (result , b )
434+ }
435+ }
436+ slices .Sort (result )
437+ return strings .Join (result , "\n " )
438+ },
439+ },
382440 {
383441 namespace : "pxc" ,
384442 // If pod logs are exported as one file per container
0 commit comments