feat: publish sanitized custom.97 source

This commit is contained in:
cneicy committed 2026-10-27 20:43:39 +08:00
1 parent 8e6ed0317b
commit 86c0276156
1022 files changed
+69903 -19207

No files matched your search

+10 -2
View File
@@ -26,10 +26,11 @@ func TestAdaptiveDetectionIntervals(t *testing.T) {
}{
{"normal", 30}, {"normal", 60}, {"normal", 60}, {"degraded", 15}, {"normal", 15}, {"normal", 30}, {"normal", 60},
{"unknown", 15}, {"unknown", 15}, {"normal", 30}, {"normal", 60}, {"failed", 15}, {"degraded", 15}, {"degraded", 30}, {"degraded", 60},
{"incomplete", 15}, {"incomplete", 30}, {"incomplete", 60}, {"failed", 15}, {"incomplete", 30}, {"normal", 15},
} {
state.IntervalMinutes = NextDetectionInterval(state.LastValid, step.result, state.IntervalMinutes)
assert.Equal(t, step.interval, state.IntervalMinutes, step.result)
if step.result == "normal" || step.result == "degraded" {
if step.result == "normal" || step.result == "degraded" || step.result == "incomplete" {
state.LastValid = step.result
}
}
@@ -119,6 +120,13 @@ func TestAdaptiveDetectionDatabaseMatrix(t *testing.T) {
require.NoError(t, db.First(&loaded, "channel_id = ? AND kind = ?", 12, "pelican").Error)
assert.Equal(t, 15, loaded.IntervalMinutes)
assert.Equal(t, int64(6400), loaded.NextDueAt)
require.NoError(t, EnsureDetectionSchedule(ctx, DetectionSchedule{ChannelID: 13, Kind: "vision", IntervalMinutes: 30}))
require.NoError(t, ApplyDetectionScheduleResult(ctx, 13, "vision", "incomplete", 7000, "incomplete"))
require.NoError(t, ApplyDetectionScheduleResult(ctx, 13, "vision", "transport-error", 7100, "failed"))
var visionSchedule DetectionSchedule
require.NoError(t, db.First(&visionSchedule, "channel_id = ? AND kind = ?", 13, "vision").Error)
assert.Equal(t, "incomplete", visionSchedule.LastValid)
assert.Equal(t, 15, visionSchedule.IntervalMinutes)
assert.Equal(t, "degraded", loaded.LastValid)
seed.Kind = "fingerprint"
require.NoError(t, EnsureDetectionSchedule(ctx, seed))
@@ -127,7 +135,7 @@ func TestAdaptiveDetectionDatabaseMatrix(t *testing.T) {
require.NoError(t, db.AutoMigrate(&SystemTask{}, &DetectionSchedule{}))
var rows []DetectionSchedule
require.NoError(t, db.Find(&rows).Error)
require.Len(t, rows, 2)
require.Len(t, rows, 3)
// Reinitializing from history must not overwrite a persisted clock.
seed.Kind = "pelican"
require.NoError(t, EnsureDetectionSchedule(ctx, seed))