mirror of
https://github.com/googleapis/genai-toolbox.git
synced 2026-02-03 03:35:02 -05:00
testing the t.cleanup ends where
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user