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
|
@ -4,6 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strconv"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
@ -81,7 +82,7 @@ func (n *Server) EnableDebug(ip string, port int) {
|
||||||
// go func() {
|
// go func() {
|
||||||
// http.Serve(n.sk, n.mux)
|
// 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
|
// DisableDebug stop the dubug and closes the tcp socket
|
||||||
|
|
|
@ -5,7 +5,9 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
stackdump "github.com/docker/docker/pkg/signal"
|
||||||
"github.com/docker/libnetwork/diagnose"
|
"github.com/docker/libnetwork/diagnose"
|
||||||
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -24,6 +26,7 @@ var NetDbPaths2Func = map[string]diagnose.HTTPHandlerFunc{
|
||||||
"/deleteentry": dbDeleteEntry,
|
"/deleteentry": dbDeleteEntry,
|
||||||
"/getentry": dbGetEntry,
|
"/getentry": dbGetEntry,
|
||||||
"/gettable": dbGetTable,
|
"/gettable": dbGetTable,
|
||||||
|
"/dump": dbStackTrace,
|
||||||
}
|
}
|
||||||
|
|
||||||
func dbJoin(ctx interface{}, w http.ResponseWriter, r *http.Request) {
|
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
|
FROM alpine
|
||||||
|
|
||||||
|
RUN apk --no-cache add curl
|
||||||
|
|
||||||
COPY testMain /app/
|
COPY testMain /app/
|
||||||
|
|
||||||
WORKDIR app
|
WORKDIR app
|
||||||
|
|
Loading…
Reference in New Issue