11package cmd
22
33import (
4+ "errors"
45 "fmt"
56 "os"
67 "path/filepath"
@@ -449,16 +450,65 @@ func modifiedPackages(changedFiles []string, version provider.Version) (map[stri
449450 return services , runFullVCR
450451}
451452
453+ func allSubFolders (root string ) (map [string ]struct {}, error ) {
454+ subfolders := make (map [string ]struct {})
455+ entries , err := os .ReadDir (root )
456+ if err != nil {
457+ return nil , fmt .Errorf ("failed to read directory '%s': %w" , root , err )
458+ }
459+
460+ for _ , entry := range entries {
461+ if entry .IsDir () {
462+ subfolders [entry .Name ()] = struct {}{}
463+ }
464+ }
465+ return subfolders , nil
466+ }
467+
452468func runReplaying (runFullVCR bool , version provider.Version , services map [string ]struct {}, vt * vcr.Tester ) (vcr.Result , []string , error ) {
453469 result := vcr.Result {}
454470 var testDirs []string
455471 var replayingErr error
456472 if runFullVCR {
457473 fmt .Println ("runReplaying: full VCR tests" )
474+ // result, replayingErr = vt.Run(vcr.RunOptions{
475+ // Mode: vcr.Replaying,
476+ // Version: version,
477+ // })
478+
479+ // temporary workaround
480+ serviceRoot := filepath .Join (vt .GetRepoPath (version ), version .ProviderName (), "services" )
481+ allServies , err := allSubFolders (serviceRoot )
482+ if err != nil {
483+ return result , testDirs , err
484+ }
485+
486+ var gkePath string
487+ var otherPaths []string
488+ for service := range allServies {
489+ servicePath := "./" + filepath .Join (version .ProviderName (), "services" , service )
490+ if service == "container" {
491+ gkePath = servicePath
492+ continue
493+ }
494+ otherPaths = append (otherPaths , servicePath )
495+ }
458496 result , replayingErr = vt .Run (vcr.RunOptions {
459- Mode : vcr .Replaying ,
460- Version : version ,
497+ Mode : vcr .Replaying ,
498+ Version : version ,
499+ TestDirs : otherPaths ,
500+ })
501+ // run gke replaying tests separately
502+ gkeResult , gkeReplayingErr := vt .Run (vcr.RunOptions {
503+ Mode : vcr .Replaying ,
504+ Version : version ,
505+ TestDirs : []string {gkePath },
461506 })
507+ replayingErr = errors .Join (replayingErr , gkeReplayingErr )
508+ result .PassedTests = append (result .PassedTests , gkeResult .PassedTests ... )
509+ result .SkippedTests = append (result .SkippedTests , gkeResult .SkippedTests ... )
510+ result .FailedTests = append (result .FailedTests , gkeResult .FailedTests ... )
511+ result .Panics = append (result .Panics , gkeResult .Panics ... )
462512 } else if len (services ) > 0 {
463513 fmt .Printf ("runReplaying: %d specific services: %v\n " , len (services ), services )
464514 for service := range services {
@@ -470,9 +520,7 @@ func runReplaying(runFullVCR bool, version provider.Version, services map[string
470520 Version : version ,
471521 TestDirs : []string {servicePath },
472522 })
473- if serviceReplayingErr != nil {
474- replayingErr = serviceReplayingErr
475- }
523+ replayingErr = errors .Join (replayingErr , serviceReplayingErr )
476524 result .PassedTests = append (result .PassedTests , serviceResult .PassedTests ... )
477525 result .SkippedTests = append (result .SkippedTests , serviceResult .SkippedTests ... )
478526 result .FailedTests = append (result .FailedTests , serviceResult .FailedTests ... )
0 commit comments