A test to reproduce the issue

This commit is contained in:
Daniel Nephin 2022-02-04 14:04:12 -05:00
parent fcf804043c
commit 5a0e6700c1
1 changed files with 34 additions and 0 deletions

View File

@ -5977,6 +5977,40 @@ func setupIngressState(t *testing.T, s *Store) memdb.WatchSet {
return ws
}
func TestStore_EnsureService_DoesNotPanicOnIngressGateway(t *testing.T) {
store := NewStateStore(nil)
err := store.EnsureConfigEntry(1, &structs.IngressGatewayConfigEntry{
Kind: structs.IngressGateway,
Name: "the-ingress",
Listeners: []structs.IngressListener{
{
Port: 12345,
Protocol: "tcp",
Services: []structs.IngressService{{Name: "the-service"}},
},
},
})
require.NoError(t, err)
err = store.EnsureRegistration(2, &structs.RegisterRequest{
Node: "the-node",
Service: &structs.NodeService{
Kind: structs.ServiceKindConnectProxy,
Service: "the-proxy",
Proxy: structs.ConnectProxyConfig{
DestinationServiceName: "the-ingress",
Upstreams: []structs.Upstream{
{
DestinationName: "the-service",
},
},
},
},
})
require.NoError(t, err)
}
func TestStateStore_DumpGatewayServices(t *testing.T) {
s := testStateStore(t)