31 lines
860 B
Go
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)
|
|
}
|
|
})
|
|
}
|
|
}
|