Update go dependencies

This commit is contained in:
Manuel Alejandro de Brito Fontes 2020-01-26 10:24:11 -03:00
parent 2f8cbeb8fa
commit 23e7565ebc
396 changed files with 57233 additions and 47523 deletions

View file

@ -4,11 +4,13 @@ import (
"fmt"
"io"
"io/ioutil"
"net"
"net/http"
"net/url"
"os"
"os/exec"
"path"
"strconv"
"time"
"github.com/onsi/gomega/gbytes"
@ -38,6 +40,10 @@ type ProcessState struct {
// Deprecated: Use HealthCheckEndpoint in favour of StartMessage
StartMessage string
Args []string
// ready holds wether the process is currently in ready state (hit the ready condition) or not.
// It will be set to true on a successful `Start()` and set to false on a successful `Stop()`
ready bool
}
type DefaultedProcessInput struct {
@ -71,7 +77,7 @@ func DoDefaulting(
}
defaults.URL = url.URL{
Scheme: "http",
Host: fmt.Sprintf("%s:%d", host, port),
Host: net.JoinHostPort(host, strconv.Itoa(port)),
}
} else {
defaults.URL = *listenUrl
@ -107,6 +113,10 @@ func DoDefaulting(
type stopChannel chan struct{}
func (ps *ProcessState) Start(stdout, stderr io.Writer) (err error) {
if ps.ready {
return nil
}
command := exec.Command(ps.Path, ps.Args...)
ready := make(chan bool)
@ -131,6 +141,7 @@ func (ps *ProcessState) Start(stdout, stderr io.Writer) (err error) {
select {
case <-ready:
ps.ready = true
return nil
case <-timedOut:
if pollerStopCh != nil {
@ -194,7 +205,7 @@ func (ps *ProcessState) Stop() error {
case <-timedOut:
return fmt.Errorf("timeout waiting for process %s to stop", path.Base(ps.Path))
}
ps.ready = false
if ps.DirNeedsCleaning {
return os.RemoveAll(ps.Dir)
}