Compare commits

..

1 Commits

Author SHA1 Message Date
Yuan Teoh
98e5e62910 ci: add oceanbase link to lycheeignore 2026-01-22 23:18:05 -08:00
3 changed files with 4 additions and 56 deletions

View File

@@ -39,7 +39,7 @@ https://dev.mysql.com/doc/refman/8.4/en/user-names.html
# npmjs links can occasionally trigger rate limiting during high-frequency CI builds
https://www.npmjs.com/package/@toolbox-sdk/core
https://www.npmjs.com/package/@toolbox-sdk/adk
https://www.oceanbase.com/
# Ignore social media and blog profiles to reduce external request overhead
https://medium.com/@mcp_toolbox
https://medium.com/@mcp_toolbox

View File

@@ -214,15 +214,12 @@ func AddPostgresPrebuiltConfig(t *testing.T, config map[string]any) map[string]a
PostgresListDatabaseStatsToolKind = "postgres-list-database-stats"
PostgresListRolesToolKind = "postgres-list-roles"
PostgresListStoredProcedureToolKind = "postgres-list-stored-procedure"
)
tools, ok := config["tools"].(map[string]any)
if !ok {
t.Fatalf("unable to get tools from config")
}
tools["list_tables"] = map[string]any{
"kind": PostgresListTablesToolKind,
"source": "my-instance",
@@ -946,8 +943,6 @@ func TestCloudSQLMySQL_IPTypeParsingFromYAML(t *testing.T) {
// Finds and drops all tables in a postgres database.
func CleanupPostgresTables(t *testing.T, ctx context.Context, pool *pgxpool.Pool) {
t.Logf("in cleanupPostgrestTables");
query := `
SELECT table_name FROM information_schema.tables
WHERE table_schema = 'public' AND table_type = 'BASE TABLE';`
@@ -969,31 +964,14 @@ func CleanupPostgresTables(t *testing.T, ctx context.Context, pool *pgxpool.Pool
}
if len(tablesToDrop) == 0 {
t.Logf("No tables to drop in 'public' schema")
return
}
t.Logf("Tables to drop in 'public' schema: %s", strings.Join(tablesToDrop, ", "))
dropQuery := fmt.Sprintf("DROP TABLE IF EXISTS %s CASCADE;", strings.Join(tablesToDrop, ", "))
if _, err := pool.Exec(ctx, dropQuery); err != nil {
t.Fatalf("Failed to drop all tables in 'public' schema: %v", err)
}
t.Logf("Dropped tables in 'public' schema: %s", strings.Join(tablesToDrop, ", "))
// // 1. Drop the entire public schema (this kills tables, views, types, etc.)
// dropSchema := "DROP SCHEMA public CASCADE;"
// // 2. Recreate the empty public schema
// createSchema := "CREATE SCHEMA public;"
// // 3. Grant permissions back (Postgres default)
// grantPublic := "GRANT ALL ON SCHEMA public TO public;"
// _, err := pool.Exec(ctx, dropSchema + createSchema + grantPublic)
// if err != nil {
// t.Fatalf("Failed to nuclear-wipe the public schema: %v", err)
// }
}
// Finds and drops all tables in a mysql database.

View File

@@ -81,25 +81,6 @@ func initPostgresConnectionPool(host, port, user, pass, dbname string) (*pgxpool
return pool, nil
}
func CreateIsolatedSchema(t *testing.T, ctx context.Context, pool *pgxpool.Pool) (string, func()) {
schemaName := "test_schema_" + strings.ReplaceAll(uuid.New().String(), "-", "")
_, err := pool.Exec(ctx, fmt.Sprintf("CREATE SCHEMA %q;", schemaName))
if err != nil {
t.Fatalf("failed to create sandbox schema: %v", err)
}
cleanup := func() {
// Use Background context to ensure cleanup runs even if the test timed out
_, err := pool.Exec(context.Background(), fmt.Sprintf("DROP SCHEMA %q CASCADE;", schemaName))
if err != nil {
t.Logf("Cleanup warning: failed to drop schema %s: %v", schemaName, err)
}
}
return schemaName, cleanup
}
func TestPostgres(t *testing.T) {
sourceConfig := getPostgresVars(t)
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
@@ -111,20 +92,9 @@ func TestPostgres(t *testing.T) {
if err != nil {
t.Fatalf("unable to create postgres connection pool: %s", err)
}
defer pool.Close()
//this was conflicting and too slow
// cleanup test environment
// tests.CleanupPostgresTables(t, ctx, pool)
schemaName, cleanupSchema := CreateIsolatedSchema(t, ctx, pool)
defer cleanupSchema()
// Force the pool to ONLY use this schema for this test run
_, err = pool.Exec(ctx, fmt.Sprintf("SET search_path TO %q;", schemaName))
if err != nil {
t.Fatalf("failed to set search path: %v", err)
}
tests.CleanupPostgresTables(t, ctx, pool)
// create table name with UUID
tableNameParam := "param_table_" + strings.ReplaceAll(uuid.New().String(), "-", "")