forked from mtusi2026/mtusi2026lab6
feat: add bounded observability and verified SLO incident alerts
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
package config
|
||||
|
||||
import "testing"
|
||||
|
||||
// TestWorkerConfiguration requires a broker and gives each process an independent consumer ID.
|
||||
func TestWorkerConfiguration(t *testing.T) {
|
||||
t.Run("missing", func(t *testing.T) {
|
||||
t.Setenv("BROKER_ADDRESS", "")
|
||||
if _, err := NewWorker(); err == nil {
|
||||
t.Fatal("missing broker accepted")
|
||||
}
|
||||
})
|
||||
t.Run("configured", func(t *testing.T) {
|
||||
t.Setenv("BROKER_ADDRESS", "broker:6379")
|
||||
first, err := NewWorker()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
second, err := NewWorker()
|
||||
if err != nil || first.Consumer == second.Consumer || first.BrokerAddress != "broker:6379" {
|
||||
t.Fatal("invalid consumer configuration")
|
||||
}
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user