add check before teardown

This commit is contained in:
rahulpinto19
2026-01-30 06:26:12 +00:00
parent e0245946ea
commit f6587cfaf8
4 changed files with 62 additions and 14 deletions

View File

@@ -124,12 +124,26 @@ func TestCloudSQLPgSimpleToolEndpoints(t *testing.T) {
// set up data for param tool
createParamTableStmt, insertParamTableStmt, paramToolStmt, idParamToolStmt, nameParamToolStmt, arrayToolStmt, paramTestParams := tests.GetPostgresSQLParamToolInfo(tableNameParam)
teardownTable1 := tests.SetupPostgresSQLTable(t, ctx, pool, createParamTableStmt, insertParamTableStmt, tableNameParam, paramTestParams)
teardownTable1,err := tests.SetupPostgresSQLTable(t, ctx, pool, createParamTableStmt, insertParamTableStmt, tableNameParam, paramTestParams)
if err != nil {
// If an error happened, we still try to run teardown if it was returned
if teardownTable1 != nil {
defer teardownTable1(t)
}
t.Fatalf("Setup failed: %v", err)
}
defer teardownTable1(t)
// set up data for auth tool
createAuthTableStmt, insertAuthTableStmt, authToolStmt, authTestParams := tests.GetPostgresSQLAuthToolInfo(tableNameAuth)
teardownTable2 := tests.SetupPostgresSQLTable(t, ctx, pool, createAuthTableStmt, insertAuthTableStmt, tableNameAuth, authTestParams)
teardownTable2,err := tests.SetupPostgresSQLTable(t, ctx, pool, createAuthTableStmt, insertAuthTableStmt, tableNameAuth, authTestParams)
if err != nil {
// If an error happened, we still try to run teardown if it was returned
if teardownTable2 != nil {
defer teardownTable2(t)
}
t.Fatalf("Setup failed: %v", err)
}
defer teardownTable2(t)
// Set up table for semantic search