Перенеси реализацию мессенджера из ЛР 6
Application / e2e (pull_request) Blocked by required conditions
Application / unit (pull_request) Blocked by required conditions
Skeleton contracts / contracts (pull_request) Blocked by required conditions

Источник — проверенное рабочее дерево ЛР 6 поверх 18878d6, включая изменения после повторного ревью. SHA-256 списка исходных файлов: e45a3d85b41feff1da78dce3f20fd1f4af1c5ee629e6ed703218bc8e21ad58fe.
This commit is contained in:
2026-11-30 10:54:41 +03:00
parent 20afc2c790
commit 8054913ef9
204 changed files with 23709 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
package config
import (
"os"
"path/filepath"
"testing"
"time"
)
func TestLoadJobs(t *testing.T) {
path := filepath.Join(t.TempDir(), "url")
if err := os.WriteFile(path, []byte("amqp://worker:secret@broker:5672/\n"), 0600); err != nil {
t.Fatal(err)
}
values := map[string]string{"BROKER_URL_FILE": path}
lookup := func(k string) (string, bool) { v, ok := values[k]; return v, ok }
cfg, err := LoadJobs(lookup)
if err != nil || cfg.Timeout != 60*time.Second || cfg.MaxAttempts != 5 || cfg.Concurrency < 1 || cfg.URL != "amqp://worker:secret@broker:5672/" {
t.Fatalf("unexpected defaults or secret read, err=%v", err)
}
for _, key := range []string{"JOB_TIMEOUT_SECONDS", "WORKER_CONCURRENCY", "JOB_MAX_ATTEMPTS"} {
values[key] = "0"
if _, err := LoadJobs(lookup); err == nil {
t.Errorf("%s accepted zero", key)
}
delete(values, key)
}
}