test: add timeout

This commit is contained in:
Kevin Franklin Kim 2022-02-03 09:02:34 +01:00
parent 8f5bbd9b30
commit c7a188048a

View File

@ -33,6 +33,7 @@ func (s *KeelTestSuite) SetupSuite() {
// BeforeTest hook
func (s *KeelTestSuite) BeforeTest(suiteName, testName string) {
s.l = keeltest.NewLogger(s.T()).Zap()
s.mux = http.NewServeMux()
s.mux.HandleFunc("/ok", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
@ -65,6 +66,7 @@ func (s *KeelTestSuite) BeforeTest(suiteName, testName string) {
// AfterTest hook
func (s *KeelTestSuite) AfterTest(suiteName, testName string) {
s.cancel()
time.Sleep(time.Second * 3)
}
// TearDownSuite hook
@ -194,7 +196,6 @@ func (s *KeelTestSuite) runServer() {
go func(waitChan chan string) {
waitChan <- "finished"
s.svr.Run()
time.Sleep(time.Second * 3)
}(waitChan)
l.Debug("waiting for server process to start")
<-waitChan