Instrument durable messenger with OTel, provision Grafana and prove SLO incident detection
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package messenger
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"os/exec"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestTransformFailureClassification(t *testing.T) {
|
||||
for _, c := range []struct {
|
||||
command string
|
||||
invalid bool
|
||||
}{{"exit 65", true}, {"exit 2", false}, {"kill -KILL $$", false}} {
|
||||
e := exec.Command("sh", "-c", c.command).Run()
|
||||
if errors.Is(classifyTransformFailure(nil, e), ErrInvalidImage) != c.invalid {
|
||||
t.Fatalf("misclassified encoder termination %q", c.command)
|
||||
}
|
||||
}
|
||||
if !errors.Is(classifyTransformFailure(context.DeadlineExceeded, nil), context.DeadlineExceeded) {
|
||||
t.Fatal("deadline lost")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user