fix : Failed to request test list when excepting status code 200

This commit is contained in:
yuki2006
2015-11-23 02:46:03 +09:00
parent 8a7b1a81ac
commit b2ec002b4d

View File

@@ -3,9 +3,9 @@ package main
import (
"encoding/json"
"fmt"
"github.com/revel/revel"
"github.com/revel/cmd/harness"
"github.com/revel/modules/testrunner/app/controllers"
"github.com/revel/revel"
"io"
"io/ioutil"
"net/http"
@@ -117,13 +117,19 @@ You can add it to a run mode configuration with the following line:
)
for i := 0; ; i++ {
if resp, err = http.Get(baseUrl + "/@tests.list"); err == nil {
break
if resp.StatusCode == 200 {
break
}
}
if i < 3 {
time.Sleep(3 * time.Second)
continue
}
errorf("Failed to request test list: %s", err)
if err != nil {
errorf("Failed to request test list: %s", err)
} else {
errorf("Failed to request test list: Not status code 200")
}
}
defer resp.Body.Close()
json.NewDecoder(resp.Body).Decode(&testSuites)