From a18fe045dde1864c845e45689719f8cc0964ca1b Mon Sep 17 00:00:00 2001 From: rahulpinto19 Date: Mon, 2 Feb 2026 11:00:22 +0000 Subject: [PATCH] testing the t.cleanup ends where --- tests/postgres/postgres_integration_test.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/postgres/postgres_integration_test.go b/tests/postgres/postgres_integration_test.go index 06cb19310d..1146d14d17 100644 --- a/tests/postgres/postgres_integration_test.go +++ b/tests/postgres/postgres_integration_test.go @@ -92,9 +92,10 @@ func TestPostgres(t *testing.T) { if err != nil { t.Fatalf("unable to create postgres connection pool: %s", err) } - + t.Fatalf("force failure") + // cleanup test environment - tests.CleanupPostgresTables(t, ctx, pool) + // tests.CleanupPostgresTables(t, ctx, pool) // create table name with UUID tableNameParam := "param_table_" + strings.ReplaceAll(uuid.New().String(), "-", "") @@ -115,6 +116,10 @@ func TestPostgres(t *testing.T) { vectorTableName, tearDownVectorTable := tests.SetupPostgresVectorTable(t, ctx, pool) defer tearDownVectorTable(t) + t.Cleanup(func() { + fmt.Println("this is executed after the failure"); + tests.CleanupPostgresTables(t, context.Background(), pool) + }) // Write config into a file and pass it to command toolsFile := tests.GetToolsConfig(sourceConfig, PostgresToolType, paramToolStmt, idParamToolStmt, nameParamToolStmt, arrayToolStmt, authToolStmt) toolsFile = tests.AddExecuteSqlConfig(t, toolsFile, "postgres-execute-sql")