Skip to content

Commit 36b1b7e

Browse files
xds: mock dual-stack bind lookup in delta tests
1 parent c18503c commit 36b1b7e

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

agent/xds/xds_protocol_helpers_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import (
3434

3535
"github.com/hashicorp/consul/agent/connect"
3636
"github.com/hashicorp/consul/agent/grpc-external/limiter"
37+
"github.com/hashicorp/consul/agent/netutil"
3738
"github.com/hashicorp/consul/agent/proxycfg"
3839
"github.com/hashicorp/consul/agent/structs"
3940
"github.com/hashicorp/consul/agent/xds/response"
@@ -188,6 +189,8 @@ func newTestServerDeltaScenario(
188189
) *testServerScenario {
189190
mgr := newTestManager()
190191
envoy := NewTestEnvoy(t, proxyID, token)
192+
originalGetAgentBindAddr := netutil.GetAgentBindAddrFunc
193+
netutil.GetAgentBindAddrFunc = netutil.GetMockGetAgentBindAddrFunc("0.0.0.0")
191194

192195
sink := metrics.NewInmemSink(1*time.Minute, 1*time.Minute)
193196
cfg := metrics.DefaultConfig("consul.xds.test")
@@ -197,6 +200,7 @@ func newTestServerDeltaScenario(
197200

198201
t.Cleanup(func() {
199202
envoy.Close()
203+
netutil.GetAgentBindAddrFunc = originalGetAgentBindAddr
200204
sink := &metrics.BlackholeSink{}
201205
metrics.NewGlobal(cfg, sink)
202206
})

0 commit comments

Comments
 (0)