fix(handlers/org_helpers_test): use t.Fatal instead of t.Error in error-path tests #970
Reference in New Issue
Block a user
Delete Branch "fix/org-helpers-test-panic"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fixes a Go panic regression introduced by PR #956 (my own file). Six
resolveInsideRoottests usedt.Errorfin the nil-error branch then continued toerr.Error()— iferrwas unexpectedly nil,err.Error()would panic with nil pointer dereference.Fix: Replace
t.Errorf/t.Errorwitht.Fatalf/t.Fatalin the nil-error branch so execution stops before theerr.Error()call.Affected tests:
TestResolveInsideRoot_EmptyUserPathTestResolveInsideRoot_AbsolutePathRejectedTestResolveInsideRoot_DotDotTraversalTestResolveInsideRoot_DotDotWithIntermediateTestResolveInsideRoot_NestedDotDotEscapesTestResolveInsideRoot_DotdotAtStartMotivation
Issue #965 (tier:high REGRESSION):
TestResolveInsideRoot_DotDotWithIntermediatepanics with nil pointer dereference onerr.Error().Test plan
Go not available in container; CI runs the suite.
SOP Checklist
🤖 Generated with Claude Code
SRE Review: APPROVE
Fixes nil-pointer panic regression in PR #956. Six TestResolveInsideRoot cases used t.Errorf in the err==nil branch, then called err.Error() — would panic if err was unexpectedly nil. Replacing with t.Fatalf stops execution immediately, preventing the panic.
All 6 instances are in the nil-error guard, so t.Fatalf is the correct choice.
Ready to merge.
1088f2032eto95c62c6fcd/sop-ack comprehensive-testing
/sop-ack local-postgres-e2e
/sop-ack staging-smoke
/sop-ack five-axis-review
/sop-ack memory-consulted
[core-qa-agent] APPROVED — t.Fatal instead of t.Error in error-path tests