buildbot: be more patient when waiting for camlistored

I'm hoping this will help with our first test suite run (Go1) which
is often failing at the test trying to hit http://localhost:3179/ui

Change-Id: I972072ebc27b7a59136a90532000ca7e9d58a471
This commit is contained in:
mpl 2014-07-05 00:14:10 +02:00
parent bafc53703d
commit c23933efdc
1 changed files with 16 additions and 5 deletions

View File

@ -45,12 +45,14 @@ import (
"syscall"
"time"
"camlistore.org/pkg/netutil"
"camlistore.org/pkg/osutil"
)
const (
interval = 60 * time.Second // polling frequency
warmup = 30 * time.Second // duration before we test if devcam server has started properly
interval = 60 * time.Second // polling frequency
warmup = 30 * time.Second // duration before we test if devcam server has started properly
camlistoredTimeOut = time.Minute // how long we try to dial camlistored after warmup
)
var (
@ -841,8 +843,8 @@ func hitCamliUi() error {
return nil
}
func hitURL(url string) (err error) {
tsk := newTask("http.Get", url)
func hitURL(uri string) (err error) {
tsk := newTask("http.Get", uri)
defer func() {
if err != nil {
tsk.Err = fmt.Sprintf("%v", err)
@ -853,8 +855,17 @@ func hitURL(url string) (err error) {
}()
dbg.Println(tsk.String())
tsk.Start = time.Now()
u, err := url.Parse(uri)
if err != nil {
return fmt.Errorf("%v: could not get host:port to dial from %v: %v\n", tsk.String(), uri, err)
}
hostPort := u.Host
err = netutil.AwaitReachable(hostPort, camlistoredTimeOut)
if err != nil {
return fmt.Errorf("%v: camlistored unreachable at %v after %v: %v\n", tsk.String(), hostPort, camlistoredTimeOut, err)
}
var resp *http.Response
resp, err = http.Get(url)
resp, err = http.Get(uri)
if err != nil {
return fmt.Errorf("%v: %v\n", tsk.String(), err)
}