From 39959e963b3f2d4b7cbdc8a471b4a2d32eca014a Mon Sep 17 00:00:00 2001 From: Naitik Shah Date: Thu, 10 Jul 2014 23:02:29 -0700 Subject: [PATCH] more elaborate travis setup --- .travis.yml | 20 +++++++++++++++++++- grace.go | 19 ++++++++++--------- gracehttp/http_test.go | 16 ++++++++-------- 3 files changed, 37 insertions(+), 18 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6b65083..8d0c431 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,23 @@ language: go + go: - 1.2 + - 1.3 + +matrix: + fast_finish: true + +before_install: + - go get -v code.google.com/p/go.tools/cmd/vet + - go get -v github.com/golang/lint/golint + - go get -v code.google.com/p/go.tools/cmd/cover + install: - - go get -t ./... + - go install -race -v std + - go get -race -t -v ./... + - go install -race -v ./... + +script: + - go vet ./... + - $HOME/gopath/bin/golint . + - go test -cpu=2 -race -cover -v ./... diff --git a/grace.go b/grace.go index 85d12df..7a70b1f 100644 --- a/grace.go +++ b/grace.go @@ -17,10 +17,10 @@ import ( ) var ( - // This error is returned by Inherits() when we're not inheriting any fds. + // ErrNotInheriting is returned by Inherits() when we're not inheriting any fds. ErrNotInheriting = errors.New("grace: no inherited listeners") - // This error is returned by Listener.Accept() when Close is in progress. + // ErrAlreadyClosed is returned by Listener.Accept() when Close is in progress. ErrAlreadyClosed = errors.New("grace: already closed") errRestartListeners = errors.New("grace: restart must be given listeners") @@ -76,7 +76,8 @@ func (c *conn) Close() error { return c.Conn.Close() } -// Wraps an existing File listener to provide a graceful Close() process. +// NewListener wraps an existing File listener to provide a graceful Close() +// process. func NewListener(l Listener) Listener { return &listener{Listener: l} } @@ -215,7 +216,7 @@ func (p *Process) Wait(listeners []Listener) error { } } -// Try to inherit listeners from the parent process. +// Inherit listeners from the parent process. func (p *Process) Inherit() (listeners []Listener, err error) { countStr := os.Getenv(envCountKey) if countStr == "" { @@ -239,8 +240,8 @@ func (p *Process) Inherit() (listeners []Listener, err error) { return } -// Start the Close process in the parent. This does not wait for the -// parent to close and simply sends it the TERM signal. +// CloseParent starts the close process in the parent. This does not wait for +// the parent to close and simply sends it the TERM signal. func (p *Process) CloseParent() error { ppid := os.Getppid() if ppid == 1 { // init provided sockets, for example systemd @@ -304,13 +305,13 @@ func Wait(listeners []Listener) (err error) { return defaultProcess.Wait(listeners) } -// Try to inherit listeners from the parent process. +// Inherit listeners from the parent process. func Inherit() (listeners []Listener, err error) { return defaultProcess.Inherit() } -// Start the Close process in the parent. This does not wait for the -// parent to close and simply sends it the TERM signal. +// CloseParent starts the close process in the parent. This does not wait for +// the parent to close and simply sends it the TERM signal. func CloseParent() error { return defaultProcess.CloseParent() } diff --git a/gracehttp/http_test.go b/gracehttp/http_test.go index a5b2a63..7ce36f9 100644 --- a/gracehttp/http_test.go +++ b/gracehttp/http_test.go @@ -210,18 +210,18 @@ func (h *harness) SendOne(dialgroup *sync.WaitGroup, url string, pid int) { // Send test HTTP request. func (h *harness) SendRequest() { pid := h.MostRecentProcess().Pid - httpFastUrl := fmt.Sprintf("http://%s/sleep/?duration=0", h.httpAddr) - httpSlowUrl := fmt.Sprintf("http://%s/sleep/?duration=2s", h.httpAddr) - httpsFastUrl := fmt.Sprintf("https://%s/sleep/?duration=0", h.httpsAddr) - httpsSlowUrl := fmt.Sprintf("https://%s/sleep/?duration=2s", h.httpsAddr) + httpFastURL := fmt.Sprintf("http://%s/sleep/?duration=0", h.httpAddr) + httpSlowURL := fmt.Sprintf("http://%s/sleep/?duration=2s", h.httpAddr) + httpsFastURL := fmt.Sprintf("https://%s/sleep/?duration=0", h.httpsAddr) + httpsSlowURL := fmt.Sprintf("https://%s/sleep/?duration=2s", h.httpsAddr) var dialgroup sync.WaitGroup h.RequestWaitGroup.Add(4) dialgroup.Add(4) - go h.SendOne(&dialgroup, httpFastUrl, pid) - go h.SendOne(&dialgroup, httpSlowUrl, pid) - go h.SendOne(&dialgroup, httpsFastUrl, pid) - go h.SendOne(&dialgroup, httpsSlowUrl, pid) + go h.SendOne(&dialgroup, httpFastURL, pid) + go h.SendOne(&dialgroup, httpSlowURL, pid) + go h.SendOne(&dialgroup, httpsFastURL, pid) + go h.SendOne(&dialgroup, httpsSlowURL, pid) debug("Added Requests pid=%d", pid) dialgroup.Wait() debug("Dialed Requests pid=%d", pid)