MCPcopy Create free account
hub / github.com/github/gh-aw / TestErrorCollectorAdd_FailFast

Function TestErrorCollectorAdd_FailFast

pkg/workflow/error_aggregation_test.go:48–63  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

46}
47
48func TestErrorCollectorAdd_FailFast(t *testing.T) {
49 collector := NewErrorCollector(true)
50 err1 := errors.New("first error")
51 err2 := errors.New("second error")
52
53 // First error should be returned immediately
54 result := collector.Add(err1)
55 require.Error(t, result, "Should return error immediately in fail-fast mode")
56 assert.Equal(t, err1, result, "Should return the exact error")
57 assert.Equal(t, 0, collector.Count(), "Should not collect errors in fail-fast mode")
58
59 // Second error should also be returned immediately
60 result = collector.Add(err2)
61 require.Error(t, result, "Should return error immediately in fail-fast mode")
62 assert.Equal(t, err2, result, "Should return the exact error")
63}
64
65func TestErrorCollectorAdd_Aggregate(t *testing.T) {
66 collector := NewErrorCollector(false)

Callers

nothing calls this directly

Calls 4

AddMethod · 0.95
CountMethod · 0.95
NewErrorCollectorFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected