test(backup): 迁移计数更新到 45 并补 44/45 内容断言;新增 backup_schedule 真实库往返集成测试
- migrations_test.go 之前硬编码 44:新增 000045 后该包测试失败(全量套件里才暴露) - 现在断言 migration 44 = production_kb_bindings、45 = backup_schedule - 新增 TestBackupScheduleRoundTripIntegration:默认值 → 保存(upsert 单行) → 读回(含 updated_by/at) → 记录下发结果(不改计划);实测在 governance 库隔离 schema 上 PASS(0.95s)
This commit is contained in:
@@ -11,8 +11,8 @@ func TestEmbeddedMigrationsAreVersionSorted(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("loadMigrations() error = %v", err)
|
||||
}
|
||||
if len(migrations) != 44 {
|
||||
t.Fatalf("migration count = %d, want 44", len(migrations))
|
||||
if len(migrations) != 45 {
|
||||
t.Fatalf("migration count = %d, want 45", len(migrations))
|
||||
}
|
||||
if migrations[0].Version != 1 || !strings.Contains(migrations[0].UpSQL, "CREATE TABLE IF NOT EXISTS jobs") {
|
||||
t.Fatalf("migration 1 = %#v", migrations[0])
|
||||
@@ -108,6 +108,13 @@ func TestEmbeddedMigrationsAreVersionSorted(t *testing.T) {
|
||||
if migrations[42].Version != 43 || !strings.Contains(migrations[42].UpSQL, "test_weknora_base_url") || !strings.Contains(migrations[42].UpSQL, "production_tenant_id") || !strings.Contains(migrations[42].UpSQL, "production_knowledge_base_id") {
|
||||
t.Fatalf("migration 43 = %#v", migrations[42])
|
||||
}
|
||||
if migrations[43].Version != 44 || !strings.Contains(migrations[43].UpSQL, "CREATE TABLE production_kb_bindings") {
|
||||
t.Fatalf("migration 44 = %#v", migrations[43])
|
||||
}
|
||||
// 000045:整库逻辑备份的定时计划(系统设置 → 存储与备份)。
|
||||
if migrations[44].Version != 45 || !strings.Contains(migrations[44].UpSQL, "CREATE TABLE backup_schedule") {
|
||||
t.Fatalf("migration 45 = %#v", migrations[44])
|
||||
}
|
||||
}
|
||||
|
||||
func TestProcessingConfirmationMigrationSeparatesPlanningFromUpload(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user