mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-29 15:10:35 +03:00
commands: Fix failing Travis server test
This commit is contained in:
parent
14c35c8a56
commit
9c782d5147
2 changed files with 9 additions and 16 deletions
|
@ -38,9 +38,9 @@ func TestServer(t *testing.T) {
|
|||
os.RemoveAll(dir)
|
||||
}()
|
||||
|
||||
stop, started := make(chan bool), make(chan bool)
|
||||
stop := make(chan bool)
|
||||
|
||||
scmd := newServerCmdSignaled(stop, started)
|
||||
scmd := newServerCmdSignaled(stop)
|
||||
|
||||
cmd := scmd.getCommand()
|
||||
cmd.SetArgs([]string{"-s=" + dir, fmt.Sprintf("-p=%d", port)})
|
||||
|
@ -50,11 +50,10 @@ func TestServer(t *testing.T) {
|
|||
assert.NoError(err)
|
||||
}()
|
||||
|
||||
select {
|
||||
case <-started:
|
||||
case <-time.After(2 * time.Second):
|
||||
t.Fatal("server start took too long")
|
||||
}
|
||||
// There is no way to know exactly when the server is ready for connections.
|
||||
// We could improve by something like https://golang.org/pkg/net/http/httptest/#Server
|
||||
// But for now, let us sleep and pray!
|
||||
time.Sleep(2 * time.Second)
|
||||
|
||||
resp, err := http.Get("http://localhost:1331/")
|
||||
assert.NoError(err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue