internal/agent/permanent/permanent_test.go
Ref: Size: 546 B History
package permanent
import (
"errors"
"testing"
)
func TestErrorfCarriesTheMarkerAndKeepsTheCause(t *testing.T) {
inner := errors.New("boom")
e := Errorf("wrapped: %w", inner)
if got := e.Error(); got != "wrapped: boom" {
t.Fatalf("Error() = %q, want %q", got, "wrapped: boom")
}
if !errors.Is(e, inner) {
t.Fatal("Errorf must keep the wrapped cause in the chain")
}
var p interface{ Permanent() bool }
if !errors.As(e, &p) || !p.Permanent() {
t.Fatal("Errorf must carry the Permanent() marker reconcile terminal-fails on")
}
}