test: update integration tests for Echo v5 compatibility
Update all integration test files to work with Echo v5 changes. Changes in new_fixes_test.go: - Update test helper signatures for *echo.Context - Fix context handling in test assertions Changes in security_test.go: - Update security test signatures for Echo v5 Changes in test_helpers.go: - Update test setup for Echo v5 - Fix context type usage in test helpers Changes in websocket_test.go: - Update WebSocket test for Echo v5 compatibility - Fix response wrapper usage for v5 API - Update hijacker interface expectations - Echo v5 now properly implements rwUnwrapper - WebSocket upgrade works natively without custom wrappers All tests now properly work with Echo v5's pointer-based context and improved WebSocket support.
This commit is contained in:
@@ -26,8 +26,8 @@ import (
|
||||
"github.com/google/uuid"
|
||||
"github.com/jackc/pgx/v5/pgtype"
|
||||
"github.com/jackc/pgx/v5/pgxpool"
|
||||
"github.com/labstack/echo/v4"
|
||||
echomiddleware "github.com/labstack/echo/v4/middleware"
|
||||
"github.com/labstack/echo/v5"
|
||||
echomiddleware "github.com/labstack/echo/v5/middleware"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -486,7 +486,7 @@ func setupTestServer(t *testing.T) *TestServerSetup {
|
||||
e.Validator = &CustomValidator{validator: v}
|
||||
|
||||
// Middleware
|
||||
e.Use(echomiddleware.Logger())
|
||||
e.Use(echomiddleware.RequestLogger())
|
||||
e.Use(echomiddleware.Recover())
|
||||
e.Use(echomiddleware.CORS())
|
||||
|
||||
@@ -523,12 +523,13 @@ func setupTestServer(t *testing.T) *TestServerSetup {
|
||||
ln, err := net.Listen("tcp", "127.0.0.1:0")
|
||||
require.NoError(t, err, "Failed to create listener")
|
||||
// Configure Echo's HTTP server with the listener
|
||||
e.Server.Handler = e
|
||||
e.Server.Addr = ln.Addr().String()
|
||||
// Create test server using Echo's server config (supports WebSocket hijacking)
|
||||
serverConfig := &http.Server{
|
||||
Handler: e,
|
||||
Addr: ln.Addr().String(),
|
||||
}
|
||||
ts := &httptest.Server{
|
||||
Listener: ln,
|
||||
Config: e.Server,
|
||||
Config: serverConfig,
|
||||
}
|
||||
ts.Start()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user