Skip to content

Commit b5ed71c

Browse files
shimbacoclaude
andcommitted
CI環境でのDBテストスキップを追加
SetupTestDBに-shortフラグのチェックを追加し、CI環境でDB接続を 必要としないテストのみ実行できるようにした。これによりCI環境で のテストタイムアウトを解消。 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent dfc99a4 commit b5ed71c

File tree

1 file changed

+5
-0
lines changed
  • go/internal/testutil

1 file changed

+5
-0
lines changed

go/internal/testutil/db.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,14 @@ import (
1212

1313
// SetupTestDB はテスト用のデータベース接続とトランザクションをセットアップする
1414
// テスト終了時にトランザクションをロールバックしてクリーンアップする
15+
// -short フラグが指定されている場合はテストをスキップする
1516
func SetupTestDB(t *testing.T) (*sql.DB, *sql.Tx) {
1617
t.Helper()
1718

19+
if testing.Short() {
20+
t.Skip("skipping database test in short mode")
21+
}
22+
1823
databaseURL := os.Getenv("DATABASE_URL")
1924
if databaseURL == "" {
2025
databaseURL = "postgres://postgres:postgres@postgresql:5432/mewst_test?sslmode=disable"

0 commit comments

Comments
 (0)