From 62942adafd358a1d7a38abd819b4a68f9d8b7ef8 Mon Sep 17 00:00:00 2001 From: Juampy NR Date: Mon, 27 Jun 2022 12:02:05 +0200 Subject: [PATCH] Remove legacy or commented integration tests --- gin_integration_test.go | 85 ----------------------------------------- 1 file changed, 85 deletions(-) diff --git a/gin_integration_test.go b/gin_integration_test.go index b0532a25d1..9642a54a6f 100644 --- a/gin_integration_test.go +++ b/gin_integration_test.go @@ -82,76 +82,6 @@ func TestBadTrustedCIDRs(t *testing.T) { assert.Error(t, router.SetTrustedProxies([]string{"hello/world"})) } -/* legacy tests -func TestBadTrustedCIDRsForRun(t *testing.T) { - os.Setenv("PORT", "") - router := New() - router.TrustedProxies = []string{"hello/world"} - assert.Error(t, router.Run(":8080")) -} - -func TestBadTrustedCIDRsForRunUnix(t *testing.T) { - router := New() - router.TrustedProxies = []string{"hello/world"} - - unixTestSocket := filepath.Join(os.TempDir(), "unix_unit_test") - - defer os.Remove(unixTestSocket) - - go func() { - router.GET("/example", func(c *Context) { c.String(http.StatusOK, "it worked") }) - assert.Error(t, router.RunUnix(unixTestSocket)) - }() - // have to wait for the goroutine to start and run the server - // otherwise the main thread will complete - time.Sleep(5 * time.Millisecond) -} - -func TestBadTrustedCIDRsForRunFd(t *testing.T) { - router := New() - router.TrustedProxies = []string{"hello/world"} - - addr, err := net.ResolveTCPAddr("tcp", "localhost:0") - assert.NoError(t, err) - listener, err := net.ListenTCP("tcp", addr) - assert.NoError(t, err) - socketFile, err := listener.File() - assert.NoError(t, err) - - go func() { - router.GET("/example", func(c *Context) { c.String(http.StatusOK, "it worked") }) - assert.Error(t, router.RunFd(int(socketFile.Fd()))) - }() - // have to wait for the goroutine to start and run the server - // otherwise the main thread will complete - time.Sleep(5 * time.Millisecond) -} - -func TestBadTrustedCIDRsForRunListener(t *testing.T) { - router := New() - router.TrustedProxies = []string{"hello/world"} - - addr, err := net.ResolveTCPAddr("tcp", "localhost:0") - assert.NoError(t, err) - listener, err := net.ListenTCP("tcp", addr) - assert.NoError(t, err) - go func() { - router.GET("/example", func(c *Context) { c.String(http.StatusOK, "it worked") }) - assert.Error(t, router.RunListener(listener)) - }() - // have to wait for the goroutine to start and run the server - // otherwise the main thread will complete - time.Sleep(5 * time.Millisecond) -} - -func TestBadTrustedCIDRsForRunTLS(t *testing.T) { - os.Setenv("PORT", "") - router := New() - router.TrustedProxies = []string{"hello/world"} - assert.Error(t, router.RunTLS(":8080", "./testdata/certificate/cert.pem", "./testdata/certificate/key.pem")) -} -*/ - func TestRunTLS(t *testing.T) { router := New() go func() { @@ -386,21 +316,6 @@ func TestConcurrentHandleContext(t *testing.T) { wg.Wait() } -// func TestWithHttptestWithSpecifiedPort(t *testing.T) { -// router := New() -// router.GET("/example", func(c *Context) { c.String(http.StatusOK, "it worked") }) - -// l, _ := net.Listen("tcp", ":8033") -// ts := httptest.Server{ -// Listener: l, -// Config: &http.Server{Handler: router}, -// } -// ts.Start() -// defer ts.Close() - -// testRequest(t, "http://localhost:8033/example") -// } - func testGetRequestHandler(t *testing.T, h http.Handler, url string) { req, err := http.NewRequest(http.MethodGet, url, nil) assert.NoError(t, err)