Files
Enterprise-Knowledge-Base/internal/application/service/system_setting_validation_test.go
T
wizardchen d496d0fc73 feat(task-queue): split upstream workers into isolated core/enrichment/maintenance pools
Route summary/sync/maintenance tasks to dedicated queues and servers so parsing, enrichment, and batch work no longer share one concurrency budget, while extending the runtime dashboard and settings validation to reflect the new topology.
2026-07-10 23:51:29 +08:00

31 lines
860 B
Go

package service
import "testing"
func TestValidateWorkerConcurrencyMinimums(t *testing.T) {
tests := []struct {
name string
key string
value any
wantErr bool
}{
{name: "upstream below one worker per pool", key: "asynq.concurrency", value: 2, wantErr: true},
{name: "upstream minimum", key: "asynq.concurrency", value: 3},
{name: "upstream normal", key: "asynq.concurrency", value: 32},
{name: "wiki zero", key: "asynq.wiki_concurrency", value: 0, wantErr: true},
{name: "wiki minimum", key: "asynq.wiki_concurrency", value: 1},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
err := validateRegistryEntry(tt.key, tt.value)
if tt.wantErr && err == nil {
t.Fatal("expected validation error")
}
if !tt.wantErr && err != nil {
t.Fatalf("unexpected validation error: %v", err)
}
})
}
}