fix: use exponential backoff mechanism to listen on nginx.StatusPort

This commit is contained in:
tokers 2021-05-13 15:02:11 +08:00
parent 714783c052
commit a08887040b
3 changed files with 54 additions and 7 deletions

View file

@ -18,7 +18,6 @@ package controller
import (
"fmt"
"net"
"net/http"
"net/http/httptest"
"os"
@ -46,7 +45,7 @@ func TestNginxCheck(t *testing.T) {
mux := http.NewServeMux()
listener, err := net.Listen("tcp", fmt.Sprintf(":%v", nginx.StatusPort))
listener, err := tryListen("tcp", fmt.Sprintf(":%v", nginx.StatusPort))
if err != nil {
t.Fatalf("creating tcp listener: %s", err)
}