Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions internal/httputil/tls_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,14 @@ func TestConfigureTLSTrustEnvironment(t *testing.T) {
err := ConfigureTLSTrustEnvironment("/tmp/ca\r.crt")
assert.ErrorContains(t, err, "invalid TLS CA cert path contains newline")
})

t.Run("propagates os.Setenv failure", func(t *testing.T) {
// os.Setenv rejects values containing a NUL byte on all supported
// platforms; this exercises the wrapped-error return branch that is
// otherwise unreachable given the newline/carriage-return guard above.
err := ConfigureTLSTrustEnvironment("/tmp/ca\x00.crt")
require.Error(t, err)
assert.Contains(t, err.Error(), "failed to set")
assert.Contains(t, err.Error(), TLSTrustEnvKeys()[0])
})
}
Loading