config/module: retry bitbucket test a few times [GH-1027]

This commit is contained in:
Mitchell Hashimoto 2015-02-23 15:24:24 -08:00
parent 6e5f60c48a
commit cab2e408d2
1 changed files with 24 additions and 9 deletions

View File

@ -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)
}
}
}