package httpapi import ( "fmt" "os" "testing" "spin/internal/models" "gorm.io/driver/postgres" "gorm.io/gorm" ) // Run with: SPIN_TEST_DB=1 go test ./internal/httpapi -run TestDBLoadQuota -v func TestDBLoadQuota(t *testing.T) { if os.Getenv("SPIN_TEST_DB") == "" { t.Skip("set SPIN_TEST_DB=1 to run against local compose db") } dsn := "postgres://spin:spin@localhost:5580/spin?sslmode=disable" gdb, err := gorm.Open(postgres.Open(dsn), &gorm.Config{}) if err != nil { t.Fatal(err) } var c models.IncentiveConfig if err := gdb.Where("year = ?", 2026).First(&c).Error; err != nil { t.Fatal(err) } fmt.Printf("loaded RankQuota=%#v\n", c.RankQuota) for k, v := range c.RankQuota { fmt.Printf(" key=%q val=%#v type=%T\n", k, v, v) } eng := toEngineConfig(c) fmt.Printf("eng.RankQuota=%#v\n", eng.RankQuota) if eng.RankQuota["주임"] != 30 { t.Fatalf("expected 30, got %v", eng.RankQuota["주임"]) } }