All checks were successful
build-and-push / build (push) Successful in 39s
- config/db/storage/auth/router/perms: eQMS 규약 미러링, 권한 2-tier (관리자 전체 / 구성원 본인·신청만), oauth2-proxy 헤더 인증 + DEV_AUTH mock - 모델: 구성원/부서, 근무(출퇴근·휴가·공가·초과), 프로젝트(회사/제품/버전· 작업자portion·담당자·태스크·계약·첨부·분할입금), 인센티브(설정·단계· 유저배분·분기정산), 회계(거래·세금) - internal/worktime: 근로기준법 월 집계 엔진 - internal/incentive: BE/non-BE × 계약금/중도금/잔금 3단계 계산 + 시뮬레이션 - 시드 데이터, Go 멀티스테이지 Dockerfile - ADMIN_GROUPS 기본값 'admin' (전 내부 앱 공통 그룹) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
38 lines
935 B
Go
38 lines
935 B
Go
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["주임"])
|
|
}
|
|
}
|