From 9f58a2851e66d1c053971cfc9f8fae090041e6a1 Mon Sep 17 00:00:00 2001 From: Uwe Hoffmann <534011+uwedeportivo@users.noreply.github.com> Date: Thu, 14 May 2020 09:31:11 -0700 Subject: [PATCH] fixes --- cmd/src/validate.go | 18 +++++++++++------- go.sum | 1 + 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/cmd/src/validate.go b/cmd/src/validate.go index d4c430a219..9348d1e15c 100644 --- a/cmd/src/validate.go +++ b/cmd/src/validate.go @@ -236,8 +236,7 @@ query ListRepos($cloneInProgress: Boolean!, $cloned: Boolean!, $notCloned: Boole } }` -func (vd *validator) listClonedRepos(filterNames interface{}) ([]string, error) { - fs := vd.convertStringList(filterNames) +func (vd *validator) listClonedReposImpl(fs []string) ([]string, error) { var resp struct { Repositories struct { Nodes []struct { @@ -261,20 +260,25 @@ func (vd *validator) listClonedRepos(filterNames interface{}) ([]string, error) return names, err } -func (vd *validator) waitRepoCloned(repoName string, sleepSeconds int, maxTries int) error { +func (vd *validator) listClonedRepos(filterNames interface{}) ([]string, error) { + fs := vd.convertStringList(filterNames) + return vd.listClonedReposImpl(fs) +} + +func (vd *validator) waitRepoCloned(repoName string, sleepSeconds int, maxTries int) (bool, error) { nameFilter := []string{repoName} for i := 0; i < maxTries; i++ { - names, err := vd.listClonedRepos(nameFilter) + names, err := vd.listClonedReposImpl(nameFilter) if err != nil { - return err + return false, err } if len(names) == 1 { - return nil + return true, nil } time.Sleep(time.Second * time.Duration(sleepSeconds)) } - return fmt.Errorf("repo %s not cloned after %d tries", repoName, maxTries) + return false, nil } func (vd *validator) log(line string) { diff --git a/go.sum b/go.sum index afa8070202..78e7201d6b 100644 --- a/go.sum +++ b/go.sum @@ -17,6 +17,7 @@ github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls= github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-multierror v1.0.0 h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uPribsnS6o=