From f406ca0160b4993c7eaf83abe4997178a8da3028 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Fri, 4 Sep 2026 19:09:41 +0800 Subject: [PATCH] =?UTF-8?q?test=E2=9C=85:=20fail=20loudly=20instead=20of?= =?UTF-8?q?=20skipping=20when=20the=20sqlite=20setup=20breaks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The privilege-escalation tests skipped themselves when opening the in-memory database or running AutoMigrate failed. Both depend on nothing outside the process, so a failure there means the environment is genuinely broken - and a security regression that quietly does not run is worse than one that is missing, because CI stays green either way. Claude-Session: https://claude.ai/code/session_01HPTAw8b8tAdFNFn8rKdPYx --- app/admin/apis/sys_user_privesc_test.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/admin/apis/sys_user_privesc_test.go b/app/admin/apis/sys_user_privesc_test.go index 3ff837d6..b2e7eb45 100644 --- a/app/admin/apis/sys_user_privesc_test.go +++ b/app/admin/apis/sys_user_privesc_test.go @@ -34,12 +34,17 @@ import ( func setupPrivescDB(t *testing.T) (*gorm.DB, string) { t.Helper() + // Fatalf, not Skipf: this database is in-memory sqlite with no external + // dependency, so failing to open or migrate it means the environment is + // actually broken. Skipping here would let these two anti-privesc + // regression tests silently stop running while CI stays green - a + // standing assertion that never fires is worse than no assertion. db, err := gorm.Open(sqlite.Open("file::memory:"), &gorm.Config{}) if err != nil { - t.Skipf("sqlite unavailable: %v", err) + t.Fatalf("sqlite unavailable: %v", err) } if err := db.AutoMigrate(&models.SysUser{}); err != nil { - t.Skipf("automigrate: %v", err) + t.Fatalf("automigrate: %v", err) } tenant := "sys-user-privesc-" + t.Name()