more elaborate travis setup
This commit is contained in:
parent
feb0fe057f
commit
39959e963b
20
.travis.yml
20
.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 ./...
|
||||
|
19
grace.go
19
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()
|
||||
}
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user