Skip to content

Commit

Permalink
etcdmain: fix timeout on integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
purpleidea committed Jun 8, 2016
1 parent 30583e6 commit 3e4b1c9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
14 changes: 7 additions & 7 deletions etcdmain/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -439,19 +439,19 @@ func (ec *EtcdConn) Init() error {
// plns []net.Listener, ctlscfg *tls.Config, sctxs map[string]*serveCtx
listen := func(s *etcdserver.EtcdServer) {
ch := http.Handler(&cors.CORSHandler{
Handler: v2http.NewClientHandler(s, s.Cfg.ReqTimeout()),
Handler: v2http.NewClientHandler(s, s.Cfg.ReqTimeout()), // XXX
Info: ec.CorsInfo,
})
ph := v2http.NewPeerHandler(s)

// Start the peer server in a goroutine
for _, l := range plns {
go func(l net.Listener) {
e := servePeerHTTP(l, ph)
if ec.Plog != nil {
ec.Plog.Fatal(e)
ec.Plog.Fatal(servePeerHTTP(l, ph))
} else {
os.Exit(1) // TODO: write on a ch to notify
servePeerHTTP(l, ph) // doesn't return
os.Exit(1)
}
}(l)
}
Expand All @@ -460,11 +460,11 @@ func (ec *EtcdConn) Init() error {
go func(sctx *serveCtx) {
// read timeout does not work with http close notify
// TODO: https://github.com/golang/go/issues/9524
e := serve(sctx, s, ctlscfg, ch)
if ec.Plog != nil {
ec.Plog.Fatal(e)
ec.Plog.Fatal(serve(sctx, s, ctlscfg, ch))
} else {
os.Exit(1) // TODO: write on a ch to notify
serve(sctx, s, ctlscfg, ch) // doesn't return
os.Exit(1)
}
}(sctx)
}
Expand Down
3 changes: 3 additions & 0 deletions etcdserver/api/capability.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package api

import (
"fmt"
"sync"
"time"

Expand Down Expand Up @@ -71,7 +72,9 @@ func runCapabilityLoop(s *etcdserver.EtcdServer) {
enableMapMu.Lock()
enabledMap = capabilityMaps[pv.String()]
enableMapMu.Unlock()
fmt.Printf("XXXXXXXXXXXXXXXXXXXXXXXXXX: ABOUT TO PRINT...\n")
plog.Infof("enabled capabilities for version %s", pv)
fmt.Printf("XXXXXXXXXXXXXXXXXXXXXXXXXX: DONE PRINTING...\n")
}
}

Expand Down
2 changes: 2 additions & 0 deletions etcdserver/api/v2http/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ func NewClientHandler(server *etcdserver.EtcdServer, timeout time.Duration) http
mux.Handle(pprofPrefix+"/block", pprof.Handler("block"))
}

fmt.Printf("XXXXXXXXXXXXXXXXXXXXXXXXX: ABOUT TO ENABLE...\n")
api.RunCapabilityLoop(server)
fmt.Printf("XXXXXXXXXXXXXXXXXXXXXXXXX: DONE ENABLING...\n")
return requestLogger(mux)
}

Expand Down

0 comments on commit 3e4b1c9

Please sign in to comment.