Fix listen port for test infra
Update Dockerfile, curl is used for the healthcheck Add /dump for creating the routine stack trace Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
This commit is contained in:
parent
a41f623b10
commit
4037132b33
3 changed files with 16 additions and 1 deletions
|
@ -4,6 +4,7 @@ import (
|
|||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"sync"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
|
@ -81,7 +82,7 @@ func (n *Server) EnableDebug(ip string, port int) {
|
|||
// go func() {
|
||||
// http.Serve(n.sk, n.mux)
|
||||
// }()
|
||||
http.ListenAndServe(":8000", n.mux)
|
||||
http.ListenAndServe(":"+strconv.Itoa(port), n.mux)
|
||||
}
|
||||
|
||||
// DisableDebug stop the dubug and closes the tcp socket
|
||||
|
|
|
@ -5,7 +5,9 @@ import (
|
|||
"net/http"
|
||||
"strings"
|
||||
|
||||
stackdump "github.com/docker/docker/pkg/signal"
|
||||
"github.com/docker/libnetwork/diagnose"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -24,6 +26,7 @@ var NetDbPaths2Func = map[string]diagnose.HTTPHandlerFunc{
|
|||
"/deleteentry": dbDeleteEntry,
|
||||
"/getentry": dbGetEntry,
|
||||
"/gettable": dbGetTable,
|
||||
"/dump": dbStackTrace,
|
||||
}
|
||||
|
||||
func dbJoin(ctx interface{}, w http.ResponseWriter, r *http.Request) {
|
||||
|
@ -240,3 +243,12 @@ func dbGetTable(ctx interface{}, w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
func dbStackTrace(ctx interface{}, w http.ResponseWriter, r *http.Request) {
|
||||
path, err := stackdump.DumpStacks("/tmp/")
|
||||
if err != nil {
|
||||
logrus.WithError(err).Error("failed to write goroutines dump")
|
||||
} else {
|
||||
fmt.Fprintf(w, "goroutine stacks written to %s", path)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
FROM alpine
|
||||
|
||||
RUN apk --no-cache add curl
|
||||
|
||||
COPY testMain /app/
|
||||
|
||||
WORKDIR app
|
||||
|
|
Loading…
Reference in a new issue