statuses update
This commit is contained in:
51
workers/transcribe/internal/config/config_test.go
Normal file
51
workers/transcribe/internal/config/config_test.go
Normal file
@@ -0,0 +1,51 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestLoadDefaults(t *testing.T) {
|
||||
t.Setenv("RABBITMQ_URL", "")
|
||||
t.Setenv("STATUS_QUEUE", "")
|
||||
t.Setenv("NEXARA_TIMEOUT", "")
|
||||
|
||||
cfg := Load()
|
||||
if cfg.InputQueue != "transcribe.tasks" {
|
||||
t.Fatalf("InputQueue: got %q", cfg.InputQueue)
|
||||
}
|
||||
if cfg.StatusQueue != "pipeline.status" {
|
||||
t.Fatalf("StatusQueue: got %q", cfg.StatusQueue)
|
||||
}
|
||||
if cfg.NexaraTimeout != 10*time.Minute {
|
||||
t.Fatalf("NexaraTimeout: got %v", cfg.NexaraTimeout)
|
||||
}
|
||||
if cfg.PromptsSection != 1 {
|
||||
t.Fatalf("PromptsSection: got %d", cfg.PromptsSection)
|
||||
}
|
||||
}
|
||||
|
||||
func TestLoadFromEnv(t *testing.T) {
|
||||
t.Setenv("INPUT_QUEUE", "custom.tasks")
|
||||
t.Setenv("STATUS_QUEUE", "status.events")
|
||||
t.Setenv("PREFETCH", "4")
|
||||
t.Setenv("NEXARA_TIMEOUT", "2m")
|
||||
t.Setenv("PROMPTS_SECTION", "2")
|
||||
|
||||
cfg := Load()
|
||||
if cfg.InputQueue != "custom.tasks" {
|
||||
t.Fatalf("InputQueue: got %q", cfg.InputQueue)
|
||||
}
|
||||
if cfg.StatusQueue != "status.events" {
|
||||
t.Fatalf("StatusQueue: got %q", cfg.StatusQueue)
|
||||
}
|
||||
if cfg.Prefetch != 4 {
|
||||
t.Fatalf("Prefetch: got %d", cfg.Prefetch)
|
||||
}
|
||||
if cfg.NexaraTimeout != 2*time.Minute {
|
||||
t.Fatalf("NexaraTimeout: got %v", cfg.NexaraTimeout)
|
||||
}
|
||||
if cfg.PromptsSection != 2 {
|
||||
t.Fatalf("PromptsSection: got %d", cfg.PromptsSection)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user