(t *testing.T)
| 3677 | } |
| 3678 | |
| 3679 | func Test_Ctx_ProxyTrust_UnixRemoteAddr(t *testing.T) { |
| 3680 | t.Parallel() |
| 3681 | |
| 3682 | if runtime.GOOS == "windows" { |
| 3683 | t.Skip("unix sockets are not supported on windows in this test") |
| 3684 | } |
| 3685 | |
| 3686 | t.Run("unix_socket_enabled", func(t *testing.T) { |
| 3687 | t.Parallel() |
| 3688 | parts := strings.SplitN(runCtxProxyTrustUnixRemoteAddrCase(t, true), "|", 2) |
| 3689 | require.Len(t, parts, 2) |
| 3690 | require.Equal(t, "true", parts[0]) |
| 3691 | require.Equal(t, "1.1.1.1", parts[1]) |
| 3692 | }) |
| 3693 | |
| 3694 | t.Run("unix_socket_disabled", func(t *testing.T) { |
| 3695 | t.Parallel() |
| 3696 | parts := strings.SplitN(runCtxProxyTrustUnixRemoteAddrCase(t, false), "|", 2) |
| 3697 | require.Len(t, parts, 2) |
| 3698 | require.Equal(t, "false", parts[0]) |
| 3699 | require.Equal(t, "0.0.0.0", parts[1]) |
| 3700 | }) |
| 3701 | } |
| 3702 | |
| 3703 | func runCtxProxyTrustUnixRemoteAddrCase(t *testing.T, unixSocket bool) string { |
| 3704 | t.Helper() |
nothing calls this directly
no test coverage detected