config/module: retry bitbucket test a few times [GH-1027]
This commit is contained in:
parent
6e5f60c48a
commit
cab2e408d2
|
@ -2,6 +2,7 @@ package module
|
|||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
|
@ -37,8 +38,16 @@ func TestBitBucketDetector(t *testing.T) {
|
|||
pwd := "/pwd"
|
||||
f := new(BitBucketDetector)
|
||||
for i, tc := range cases {
|
||||
output, ok, err := f.Detect(tc.Input, pwd)
|
||||
var err error
|
||||
for i := 0; i < 3; i++ {
|
||||
var output string
|
||||
var ok bool
|
||||
output, ok, err = f.Detect(tc.Input, pwd)
|
||||
if err != nil {
|
||||
if strings.Contains(err.Error(), "invalid character") {
|
||||
continue
|
||||
}
|
||||
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
if !ok {
|
||||
|
@ -48,5 +57,11 @@ func TestBitBucketDetector(t *testing.T) {
|
|||
if output != tc.Output {
|
||||
t.Fatalf("%d: bad: %#v", i, output)
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
if i >= 3 {
|
||||
t.Fatalf("failure from bitbucket: %s", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue