Skip to content

Commit 9f58a28

Browse files
committed
fixes
1 parent f183a79 commit 9f58a28

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

cmd/src/validate.go

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,7 @@ query ListRepos($cloneInProgress: Boolean!, $cloned: Boolean!, $notCloned: Boole
236236
}
237237
}`
238238

239-
func (vd *validator) listClonedRepos(filterNames interface{}) ([]string, error) {
240-
fs := vd.convertStringList(filterNames)
239+
func (vd *validator) listClonedReposImpl(fs []string) ([]string, error) {
241240
var resp struct {
242241
Repositories struct {
243242
Nodes []struct {
@@ -261,20 +260,25 @@ func (vd *validator) listClonedRepos(filterNames interface{}) ([]string, error)
261260
return names, err
262261
}
263262

264-
func (vd *validator) waitRepoCloned(repoName string, sleepSeconds int, maxTries int) error {
263+
func (vd *validator) listClonedRepos(filterNames interface{}) ([]string, error) {
264+
fs := vd.convertStringList(filterNames)
265+
return vd.listClonedReposImpl(fs)
266+
}
267+
268+
func (vd *validator) waitRepoCloned(repoName string, sleepSeconds int, maxTries int) (bool, error) {
265269
nameFilter := []string{repoName}
266270

267271
for i := 0; i < maxTries; i++ {
268-
names, err := vd.listClonedRepos(nameFilter)
272+
names, err := vd.listClonedReposImpl(nameFilter)
269273
if err != nil {
270-
return err
274+
return false, err
271275
}
272276
if len(names) == 1 {
273-
return nil
277+
return true, nil
274278
}
275279
time.Sleep(time.Second * time.Duration(sleepSeconds))
276280
}
277-
return fmt.Errorf("repo %s not cloned after %d tries", repoName, maxTries)
281+
return false, nil
278282
}
279283

280284
func (vd *validator) log(line string) {

go.sum

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls=
1717
github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
1818
github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4=
1919
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
20+
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
2021
github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA=
2122
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
2223
github.com/hashicorp/go-multierror v1.0.0 h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uPribsnS6o=

0 commit comments

Comments
 (0)