From 4269a9448a0f2fa46626a06adcf9efcaec3391f1 Mon Sep 17 00:00:00 2001 From: Krzysztof Ostrowski Date: Tue, 20 Sep 2022 18:58:42 +0200 Subject: [PATCH] test/e2e: add pprof Signed-off-by: Krzysztof Ostrowski --- test/e2e/useroauthaccesstokens_test.go | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/test/e2e/useroauthaccesstokens_test.go b/test/e2e/useroauthaccesstokens_test.go index 14af2b324b..d15a17b0f4 100644 --- a/test/e2e/useroauthaccesstokens_test.go +++ b/test/e2e/useroauthaccesstokens_test.go @@ -4,6 +4,10 @@ import ( "context" "crypto/sha256" "encoding/base64" + "fmt" + "net/http" + _ "net/http/pprof" + "os" "strconv" "testing" "time" @@ -25,6 +29,29 @@ import ( userclient "github.com/openshift/client-go/user/clientset/versioned" ) +func TestMain(m *testing.M) { + go func() { + address := "127.0.0.1:8081" + fmt.Println("listen to: ", address) + if err := http.ListenAndServe(address, nil); err != nil { + fmt.Println(err) + } + }() + + result := m.Run() + + /* + sigs := make(chan os.Signal, 1) + signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM) + + fmt.Println("Waiting for SIGINT or SIGTERM") + + <-sigs + */ + + os.Exit(result) +} + func setupTokenStorage(t *testing.T, adminConfig *rest.Config, testNS string) (user1uid, user2uid, user1token, user2token string, trashBin *ResourceTrashbin, errors []error) { testCtx := context.Background() trashBin = NewResourceTrashbin(t, adminConfig)