Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

test: drop testing.Short() guards and run every test in CI (#21431)

Danny Xu18fc209075eb
diff --git a/AGENTS.md b/AGENTS.md
index 27af00b9a8..e8a4a142ff 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -36,7 +36,7 @@ Bytebase is the standard for database development. Every product and engineering
Test API and workflow behavior against PostgreSQL. Engine dialect and DDL fidelity tests belong in omni.
-- Test logic in its owning package. Use `backend/api/v1` for service behavior and `backend/store` for metadata queries, collision isolation, and transaction contention.
+- Test logic in its owning package. Use `backend/api/v1` for service behavior and `backend/store` for metadata queries, collision isolation, and transaction contention. CI runs every test with no `-short`, so never check `testing.Short()` or skip a test to park a known gap; gate a test on an environment variable only when it needs credentials or a server CI cannot provide.
- A backend test boots a Bytebase server only when it needs a background runner, real rollout, or audit trail; these tests live in `backend/tests`. Browser E2E tests use the separate frontend harness.
- Packages needing metadata PostgreSQL use `testcontainer.Main` and `testcontainer.NewMetadataDB`. Target-engine tests use `testcontainer.SharedPgContainer` or its siblings, with `NewPgDatabase` for a database per test. Use these shared fixtures instead of package-owned or per-test containers.
- Prefer pure functions for handler decisions and conversions. When state reads are necessary, define a narrow interface beside the handler and fake it, as `backend/api/mcp` does with `serverStore`; avoid an interface over the entire store. Every fake requires a contract test against the real store too.
diff --git a/backend/plugin/advisor/tidb/advisor_statement_dml_dry_run_testcontainer_test.go b/backend/plugin/advisor/tidb/advisor_statement_dml_dry_run_testcontainer_test.go
index 530fb8af1e..25b81e736f 100644
--- a/backend/plugin/advisor/tidb/advisor_statement_dml_dry_run_testcontainer_test.go
+++ b/backend/plugin/advisor/tidb/advisor_statement_dml_dry_run_testcontainer_test.go
@@ -23,9 +23,6 @@ import (
// in particular that the BATCH DRY RUN and inner-DML SQL derived by text-slicing
// (omni has no statement-level deparse) execute correctly against TiDB.
func TestStatementDMLDryRunTiDBContainer(t *testing.T) {
- if testing.Short() {
- t.Skip("Skipping TiDB testcontainer test in short mode")
- }
ctx := context.Background()
container := testcontainer.GetTestTiDBContainer(ctx, t)
defer container.Close(ctx)
diff --git a/backend/plugin/db/mongodb/mongodb_test.go b/backend/plugin/db/mongodb/mongodb_test.go
index 44d8b1ac39..9f935692fc 100644
--- a/backend/plugin/db/mongodb/mongodb_test.go
+++ b/backend/plugin/db/mongodb/mongodb_test.go
@@ -222,10 +222,6 @@ func TestExecuteLogsParseFailure(t *testing.T) {
// This ensures the fix for PR #17282 (which changed to single-quote bracket notation
// for special characters) works correctly.
func TestQueryWithBracketNotation(t *testing.T) {
- if testing.Short() {
- t.Skip("Skipping MongoDB testcontainer test in short mode")
- }
-
ctx := context.Background()
// Get MongoDB container from testcontainer utility
@@ -332,10 +328,6 @@ func TestQueryWithBracketNotation(t *testing.T) {
// TestQueryWithBracketNotationStructure tests the exact structure of query results
// using protocmp to ensure the result format is correct.
func TestQueryWithBracketNotationStructure(t *testing.T) {
- if testing.Short() {
- t.Skip("Skipping MongoDB testcontainer test in short mode")
- }
-
ctx := context.Background()
// Get MongoDB container from testcontainer utility
@@ -420,10 +412,6 @@ func TestQueryWithBracketNotationStructure(t *testing.T) {
// large integers must render in mongosh notation (plain decimal), not the Go
// driver's scientific notation (e.g. 1.779696815227E+12).
func TestQueryDoubleNotation(t *testing.T) {
- if testing.Short() {
- t.Skip("Skipping MongoDB testcontainer test in short mode")
- }
-
ctx := context.Background()
container := testcontainer.GetTestMongoDBContainer(ctx, t)
diff --git a/backend/plugin/schema/mysql/sdl_migration_test.go b/backend/plugin/schema/mysql/sdl_migration_test.go
index e0d2b79142..80009cb001 100644
--- a/backend/plugin/schema/mysql/sdl_migration_test.go
+++ b/backend/plugin/schema/mysql/sdl_migration_test.go
@@ -389,14 +389,11 @@ func TestLoadCatalogFallbackSeedsExplicitDefaultsForTimestamp(t *testing.T) {
// skipUnlessLiveOracle gates every live-oracle SDL suite in this package. These
// suites need the developer's local MySQL oracles (5.7 at 127.0.0.1:13307, 8.0 at
// 127.0.0.1:13306 — see liveServers) and are opt-in via MYSQL_SDL_LIVE_ORACLE=1.
-// CI runs `go test ./backend/...` without -short and has no such servers, so an
-// explicit environment gate (mirroring the cosmosdb integration tests) keeps the
-// suites out of CI while leaving them one env var away locally.
+// CI has no such servers, so an explicit environment gate (mirroring the cosmosdb
+// integration tests) keeps the suites out of CI while leaving them one env var
+// away locally.
func skipUnlessLiveOracle(t *testing.T) {
t.Helper()
- if testing.Short() {
- t.Skip("skipping live MySQL SDL oracle test in short mode")
- }
if os.Getenv("MYSQL_SDL_LIVE_ORACLE") == "" {
t.Skip("skipping live MySQL SDL oracle test: set MYSQL_SDL_LIVE_ORACLE=1 (needs local MySQL 5.7 at :13307 and 8.0 at :13306)")
}
diff --git a/backend/store/plan_filter_test.go b/backend/store/plan_filter_test.go
index b17b84a436..87edf20d25 100644
--- a/backend/store/plan_filter_test.go
+++ b/backend/store/plan_filter_test.go
@@ -16,7 +16,6 @@ func TestGetListPlanFilter(t *testing.T) {
wantArgs []any
wantErr bool
errContains string
- skipTest bool // Skip tests that require database access
}{
{
name: "empty filter",
@@ -127,11 +126,11 @@ func TestGetListPlanFilter(t *testing.T) {
wantErr: false,
},
{
- name: "creator filter requires database",
- filter: `creator == "users/[email protected]"`,
- skipTest: true,
- wantErr: false, // Would work with database
- errContains: "",
+ name: "creator filter",
+ filter: `creator == "users/[email protected]"`,
+ wantSQL: "(plan.creator = $1)",
+ wantArgs: []any{"[email protected]"},
+ wantErr: false,
},
{
name: "invalid filter syntax",
@@ -180,10 +179,6 @@ func TestGetListPlanFilter(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
- if tt.skipTest {
- t.Skip("Test requires database connection")
- }
-
q, err := GetListPlanFilter(tt.filter)
if tt.wantErr {