Skip to content

Commit 1f6e071

Browse files
committed
fix docker udp integration listener
1 parent 4b9a0d9 commit 1f6e071

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

integration_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func auditAddressFromListener(listenerAddr net.Addr) string {
4242
return net.JoinHostPort(host, port)
4343
}
4444

45-
func tcpListenerHost() string {
45+
func auditListenerHost() string {
4646
host := getEnvOrDefault("AUDIT_HOST", "127.0.0.1")
4747
if host == "127.0.0.1" || host == "localhost" {
4848
return host
@@ -86,7 +86,8 @@ func newIntegrationAuditServer(t *testing.T, protocol string, ruleGroups []audit
8686

8787
func startUDPAuditListener(t *testing.T, server *auditserver.AuditServer) string {
8888
t.Helper()
89-
addr, err := net.ResolveUDPAddr("udp", "127.0.0.1:0")
89+
udpListenAddr := net.JoinHostPort(auditListenerHost(), "0")
90+
addr, err := net.ResolveUDPAddr("udp", udpListenAddr)
9091
require.NoError(t, err)
9192

9293
conn, err := net.ListenUDP("udp", addr)
@@ -120,7 +121,7 @@ func startUDPAuditListener(t *testing.T, server *auditserver.AuditServer) string
120121

121122
func startTCPAuditListener(t *testing.T, server *auditserver.AuditServer) string {
122123
t.Helper()
123-
tcpListenAddr := net.JoinHostPort(tcpListenerHost(), "0")
124+
tcpListenAddr := net.JoinHostPort(auditListenerHost(), "0")
124125
addr, err := net.ResolveTCPAddr("tcp", tcpListenAddr)
125126
require.NoError(t, err)
126127

0 commit comments

Comments
 (0)