Unit test with gin web framework

Hi I have written below code to test a gin function
func TestServe(t *testing.T) {
config.SetLoggerConfig(“logger.apipath”)
router := Serve()

        w := httptest.NewRecorder()
        req, _ := http.NewRequest("GET", "/nodes", nil)
        router.ServeHTTP(w, req)

        assert.Equal(t, 200, w.Code)
}

Serve() returns a gin Engine , when i run this it gets stuck at
[GIN-debug] Listening and serving HTTP on :8080

how can i overcome this ?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.