mirror of https://github.com/status-im/consul.git
Uncomment listener tests
This commit is contained in:
parent
f4f45af6d0
commit
ad6c726453
|
@ -9,12 +9,14 @@ import (
|
||||||
"github.com/hashicorp/consul/agent/structs"
|
"github.com/hashicorp/consul/agent/structs"
|
||||||
"github.com/hashicorp/consul/agent/xds/proxysupport"
|
"github.com/hashicorp/consul/agent/xds/proxysupport"
|
||||||
"github.com/hashicorp/consul/sdk/testutil"
|
"github.com/hashicorp/consul/sdk/testutil"
|
||||||
|
"github.com/hashicorp/consul/types"
|
||||||
testinf "github.com/mitchellh/go-testing-interface"
|
testinf "github.com/mitchellh/go-testing-interface"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"sort"
|
"sort"
|
||||||
"testing"
|
"testing"
|
||||||
"text/template"
|
"text/template"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestListenersFromSnapshot(t *testing.T) {
|
func TestListenersFromSnapshot(t *testing.T) {
|
||||||
|
@ -32,447 +34,447 @@ func TestListenersFromSnapshot(t *testing.T) {
|
||||||
overrideGoldenName string
|
overrideGoldenName string
|
||||||
serverSetup func(*Server)
|
serverSetup func(*Server)
|
||||||
}{
|
}{
|
||||||
// {
|
{
|
||||||
// name: "defaults",
|
name: "defaults",
|
||||||
// create: proxycfg.TestConfigSnapshot,
|
create: proxycfg.TestConfigSnapshot,
|
||||||
// setup: nil, // Default snapshot
|
setup: nil, // Default snapshot
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// name: "listener-bind-address",
|
name: "listener-bind-address",
|
||||||
// create: proxycfg.TestConfigSnapshot,
|
create: proxycfg.TestConfigSnapshot,
|
||||||
// setup: func(snap *proxycfg.ConfigSnapshot) {
|
setup: func(snap *proxycfg.ConfigSnapshot) {
|
||||||
// snap.Proxy.Config["bind_address"] = "127.0.0.2"
|
snap.Proxy.Config["bind_address"] = "127.0.0.2"
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// name: "listener-bind-port",
|
name: "listener-bind-port",
|
||||||
// create: proxycfg.TestConfigSnapshot,
|
create: proxycfg.TestConfigSnapshot,
|
||||||
// setup: func(snap *proxycfg.ConfigSnapshot) {
|
setup: func(snap *proxycfg.ConfigSnapshot) {
|
||||||
// snap.Proxy.Config["bind_port"] = 8888
|
snap.Proxy.Config["bind_port"] = 8888
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// name: "listener-bind-address-port",
|
name: "listener-bind-address-port",
|
||||||
// create: proxycfg.TestConfigSnapshot,
|
create: proxycfg.TestConfigSnapshot,
|
||||||
// setup: func(snap *proxycfg.ConfigSnapshot) {
|
setup: func(snap *proxycfg.ConfigSnapshot) {
|
||||||
// snap.Proxy.Config["bind_address"] = "127.0.0.2"
|
snap.Proxy.Config["bind_address"] = "127.0.0.2"
|
||||||
// snap.Proxy.Config["bind_port"] = 8888
|
snap.Proxy.Config["bind_port"] = 8888
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// name: "http-public-listener",
|
name: "http-public-listener",
|
||||||
// create: proxycfg.TestConfigSnapshot,
|
create: proxycfg.TestConfigSnapshot,
|
||||||
// setup: func(snap *proxycfg.ConfigSnapshot) {
|
setup: func(snap *proxycfg.ConfigSnapshot) {
|
||||||
// snap.Proxy.Config["protocol"] = "http"
|
snap.Proxy.Config["protocol"] = "http"
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// name: "http-listener-with-timeouts",
|
name: "http-listener-with-timeouts",
|
||||||
// create: proxycfg.TestConfigSnapshot,
|
create: proxycfg.TestConfigSnapshot,
|
||||||
// setup: func(snap *proxycfg.ConfigSnapshot) {
|
setup: func(snap *proxycfg.ConfigSnapshot) {
|
||||||
// snap.Proxy.Config["protocol"] = "http"
|
snap.Proxy.Config["protocol"] = "http"
|
||||||
// snap.Proxy.Config["local_connect_timeout_ms"] = 1234
|
snap.Proxy.Config["local_connect_timeout_ms"] = 1234
|
||||||
// snap.Proxy.Config["local_request_timeout_ms"] = 2345
|
snap.Proxy.Config["local_request_timeout_ms"] = 2345
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// name: "http-upstream",
|
name: "http-upstream",
|
||||||
// create: proxycfg.TestConfigSnapshot,
|
create: proxycfg.TestConfigSnapshot,
|
||||||
// setup: func(snap *proxycfg.ConfigSnapshot) {
|
setup: func(snap *proxycfg.ConfigSnapshot) {
|
||||||
// snap.Proxy.Upstreams[0].Config["protocol"] = "http"
|
snap.Proxy.Upstreams[0].Config["protocol"] = "http"
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// name: "custom-public-listener",
|
name: "custom-public-listener",
|
||||||
// create: proxycfg.TestConfigSnapshot,
|
create: proxycfg.TestConfigSnapshot,
|
||||||
// setup: func(snap *proxycfg.ConfigSnapshot) {
|
setup: func(snap *proxycfg.ConfigSnapshot) {
|
||||||
// snap.Proxy.Config["envoy_public_listener_json"] =
|
snap.Proxy.Config["envoy_public_listener_json"] =
|
||||||
// customListenerJSON(t, customListenerJSONOptions{
|
customListenerJSON(t, customListenerJSONOptions{
|
||||||
// Name: "custom-public-listen",
|
Name: "custom-public-listen",
|
||||||
// })
|
})
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// name: "custom-public-listener-http",
|
name: "custom-public-listener-http",
|
||||||
// create: proxycfg.TestConfigSnapshot,
|
create: proxycfg.TestConfigSnapshot,
|
||||||
// setup: func(snap *proxycfg.ConfigSnapshot) {
|
setup: func(snap *proxycfg.ConfigSnapshot) {
|
||||||
// snap.Proxy.Config["protocol"] = "http"
|
snap.Proxy.Config["protocol"] = "http"
|
||||||
// snap.Proxy.Config["envoy_public_listener_json"] =
|
snap.Proxy.Config["envoy_public_listener_json"] =
|
||||||
// customHTTPListenerJSON(t, customHTTPListenerJSONOptions{
|
customHTTPListenerJSON(t, customHTTPListenerJSONOptions{
|
||||||
// Name: "custom-public-listen",
|
Name: "custom-public-listen",
|
||||||
// })
|
})
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// name: "custom-public-listener-http-2",
|
name: "custom-public-listener-http-2",
|
||||||
// create: proxycfg.TestConfigSnapshot,
|
create: proxycfg.TestConfigSnapshot,
|
||||||
// setup: func(snap *proxycfg.ConfigSnapshot) {
|
setup: func(snap *proxycfg.ConfigSnapshot) {
|
||||||
// snap.Proxy.Config["protocol"] = "http"
|
snap.Proxy.Config["protocol"] = "http"
|
||||||
// snap.Proxy.Config["envoy_public_listener_json"] =
|
snap.Proxy.Config["envoy_public_listener_json"] =
|
||||||
// customHTTPListenerJSON(t, customHTTPListenerJSONOptions{
|
customHTTPListenerJSON(t, customHTTPListenerJSONOptions{
|
||||||
// Name: "custom-public-listen",
|
Name: "custom-public-listen",
|
||||||
// HTTPConnectionManagerName: httpConnectionManagerNewName,
|
HTTPConnectionManagerName: httpConnectionManagerNewName,
|
||||||
// })
|
})
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// name: "custom-public-listener-http-missing",
|
name: "custom-public-listener-http-missing",
|
||||||
// create: proxycfg.TestConfigSnapshot,
|
create: proxycfg.TestConfigSnapshot,
|
||||||
// setup: func(snap *proxycfg.ConfigSnapshot) {
|
setup: func(snap *proxycfg.ConfigSnapshot) {
|
||||||
// snap.Proxy.Config["protocol"] = "http"
|
snap.Proxy.Config["protocol"] = "http"
|
||||||
// snap.Proxy.Config["envoy_public_listener_json"] =
|
snap.Proxy.Config["envoy_public_listener_json"] =
|
||||||
// customListenerJSON(t, customListenerJSONOptions{
|
customListenerJSON(t, customListenerJSONOptions{
|
||||||
// Name: "custom-public-listen",
|
Name: "custom-public-listen",
|
||||||
// })
|
})
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// name: "custom-public-listener-ignores-tls",
|
name: "custom-public-listener-ignores-tls",
|
||||||
// create: proxycfg.TestConfigSnapshot,
|
create: proxycfg.TestConfigSnapshot,
|
||||||
// overrideGoldenName: "custom-public-listener", // should be the same
|
overrideGoldenName: "custom-public-listener", // should be the same
|
||||||
// setup: func(snap *proxycfg.ConfigSnapshot) {
|
setup: func(snap *proxycfg.ConfigSnapshot) {
|
||||||
// snap.Proxy.Config["envoy_public_listener_json"] =
|
snap.Proxy.Config["envoy_public_listener_json"] =
|
||||||
// customListenerJSON(t, customListenerJSONOptions{
|
customListenerJSON(t, customListenerJSONOptions{
|
||||||
// Name: "custom-public-listen",
|
Name: "custom-public-listen",
|
||||||
// // Attempt to override the TLS context should be ignored
|
// Attempt to override the TLS context should be ignored
|
||||||
// TLSContext: `"allowRenegotiation": false`,
|
TLSContext: `"allowRenegotiation": false`,
|
||||||
// })
|
})
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// name: "custom-upstream",
|
name: "custom-upstream",
|
||||||
// create: proxycfg.TestConfigSnapshot,
|
create: proxycfg.TestConfigSnapshot,
|
||||||
// setup: func(snap *proxycfg.ConfigSnapshot) {
|
setup: func(snap *proxycfg.ConfigSnapshot) {
|
||||||
// snap.Proxy.Upstreams[0].Config["envoy_listener_json"] =
|
snap.Proxy.Upstreams[0].Config["envoy_listener_json"] =
|
||||||
// customListenerJSON(t, customListenerJSONOptions{
|
customListenerJSON(t, customListenerJSONOptions{
|
||||||
// Name: "custom-upstream",
|
Name: "custom-upstream",
|
||||||
// })
|
})
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// name: "custom-upstream-ignored-with-disco-chain",
|
name: "custom-upstream-ignored-with-disco-chain",
|
||||||
// create: proxycfg.TestConfigSnapshotDiscoveryChainWithFailover,
|
create: proxycfg.TestConfigSnapshotDiscoveryChainWithFailover,
|
||||||
// setup: func(snap *proxycfg.ConfigSnapshot) {
|
setup: func(snap *proxycfg.ConfigSnapshot) {
|
||||||
// snap.Proxy.Upstreams[0].Config["envoy_listener_json"] =
|
snap.Proxy.Upstreams[0].Config["envoy_listener_json"] =
|
||||||
// customListenerJSON(t, customListenerJSONOptions{
|
customListenerJSON(t, customListenerJSONOptions{
|
||||||
// Name: "custom-upstream",
|
Name: "custom-upstream",
|
||||||
// })
|
})
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// name: "splitter-with-resolver-redirect",
|
name: "splitter-with-resolver-redirect",
|
||||||
// create: proxycfg.TestConfigSnapshotDiscoveryChain_SplitterWithResolverRedirectMultiDC,
|
create: proxycfg.TestConfigSnapshotDiscoveryChain_SplitterWithResolverRedirectMultiDC,
|
||||||
// setup: nil,
|
setup: nil,
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// name: "connect-proxy-with-tcp-chain",
|
name: "connect-proxy-with-tcp-chain",
|
||||||
// create: proxycfg.TestConfigSnapshotDiscoveryChain,
|
create: proxycfg.TestConfigSnapshotDiscoveryChain,
|
||||||
// setup: nil,
|
setup: nil,
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// name: "connect-proxy-with-http-chain",
|
name: "connect-proxy-with-http-chain",
|
||||||
// create: func(t testinf.T) *proxycfg.ConfigSnapshot {
|
create: func(t testinf.T) *proxycfg.ConfigSnapshot {
|
||||||
// return proxycfg.TestConfigSnapshotDiscoveryChainWithEntries(t,
|
return proxycfg.TestConfigSnapshotDiscoveryChainWithEntries(t,
|
||||||
// &structs.ProxyConfigEntry{
|
&structs.ProxyConfigEntry{
|
||||||
// Kind: structs.ProxyDefaults,
|
Kind: structs.ProxyDefaults,
|
||||||
// Name: structs.ProxyConfigGlobal,
|
Name: structs.ProxyConfigGlobal,
|
||||||
// Config: map[string]interface{}{
|
Config: map[string]interface{}{
|
||||||
// "protocol": "http",
|
"protocol": "http",
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// )
|
)
|
||||||
// },
|
},
|
||||||
// setup: nil,
|
setup: nil,
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// name: "connect-proxy-with-http2-chain",
|
name: "connect-proxy-with-http2-chain",
|
||||||
// create: func(t testinf.T) *proxycfg.ConfigSnapshot {
|
create: func(t testinf.T) *proxycfg.ConfigSnapshot {
|
||||||
// return proxycfg.TestConfigSnapshotDiscoveryChainWithEntries(t,
|
return proxycfg.TestConfigSnapshotDiscoveryChainWithEntries(t,
|
||||||
// &structs.ProxyConfigEntry{
|
&structs.ProxyConfigEntry{
|
||||||
// Kind: structs.ProxyDefaults,
|
Kind: structs.ProxyDefaults,
|
||||||
// Name: structs.ProxyConfigGlobal,
|
Name: structs.ProxyConfigGlobal,
|
||||||
// Config: map[string]interface{}{
|
Config: map[string]interface{}{
|
||||||
// "protocol": "http2",
|
"protocol": "http2",
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// )
|
)
|
||||||
// },
|
},
|
||||||
// setup: nil,
|
setup: nil,
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// name: "connect-proxy-with-grpc-chain",
|
name: "connect-proxy-with-grpc-chain",
|
||||||
// create: func(t testinf.T) *proxycfg.ConfigSnapshot {
|
create: func(t testinf.T) *proxycfg.ConfigSnapshot {
|
||||||
// return proxycfg.TestConfigSnapshotDiscoveryChainWithEntries(t,
|
return proxycfg.TestConfigSnapshotDiscoveryChainWithEntries(t,
|
||||||
// &structs.ProxyConfigEntry{
|
&structs.ProxyConfigEntry{
|
||||||
// Kind: structs.ProxyDefaults,
|
Kind: structs.ProxyDefaults,
|
||||||
// Name: structs.ProxyConfigGlobal,
|
Name: structs.ProxyConfigGlobal,
|
||||||
// Config: map[string]interface{}{
|
Config: map[string]interface{}{
|
||||||
// "protocol": "grpc",
|
"protocol": "grpc",
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// )
|
)
|
||||||
// },
|
},
|
||||||
// setup: nil,
|
setup: nil,
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// name: "connect-proxy-with-chain-external-sni",
|
name: "connect-proxy-with-chain-external-sni",
|
||||||
// create: proxycfg.TestConfigSnapshotDiscoveryChainExternalSNI,
|
create: proxycfg.TestConfigSnapshotDiscoveryChainExternalSNI,
|
||||||
// setup: nil,
|
setup: nil,
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// name: "connect-proxy-with-chain-and-overrides",
|
name: "connect-proxy-with-chain-and-overrides",
|
||||||
// create: proxycfg.TestConfigSnapshotDiscoveryChainWithOverrides,
|
create: proxycfg.TestConfigSnapshotDiscoveryChainWithOverrides,
|
||||||
// setup: nil,
|
setup: nil,
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// name: "connect-proxy-with-tcp-chain-failover-through-remote-gateway",
|
name: "connect-proxy-with-tcp-chain-failover-through-remote-gateway",
|
||||||
// create: proxycfg.TestConfigSnapshotDiscoveryChainWithFailoverThroughRemoteGateway,
|
create: proxycfg.TestConfigSnapshotDiscoveryChainWithFailoverThroughRemoteGateway,
|
||||||
// setup: nil,
|
setup: nil,
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// name: "connect-proxy-with-tcp-chain-failover-through-local-gateway",
|
name: "connect-proxy-with-tcp-chain-failover-through-local-gateway",
|
||||||
// create: proxycfg.TestConfigSnapshotDiscoveryChainWithFailoverThroughLocalGateway,
|
create: proxycfg.TestConfigSnapshotDiscoveryChainWithFailoverThroughLocalGateway,
|
||||||
// setup: nil,
|
setup: nil,
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// name: "expose-paths-local-app-paths",
|
name: "expose-paths-local-app-paths",
|
||||||
// create: proxycfg.TestConfigSnapshotExposeConfig,
|
create: proxycfg.TestConfigSnapshotExposeConfig,
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// name: "expose-paths-new-cluster-http2",
|
name: "expose-paths-new-cluster-http2",
|
||||||
// create: proxycfg.TestConfigSnapshotExposeConfig,
|
create: proxycfg.TestConfigSnapshotExposeConfig,
|
||||||
// setup: func(snap *proxycfg.ConfigSnapshot) {
|
setup: func(snap *proxycfg.ConfigSnapshot) {
|
||||||
// snap.Proxy.Expose.Paths[1] = structs.ExposePath{
|
snap.Proxy.Expose.Paths[1] = structs.ExposePath{
|
||||||
// LocalPathPort: 9090,
|
LocalPathPort: 9090,
|
||||||
// Path: "/grpc.health.v1.Health/Check",
|
Path: "/grpc.health.v1.Health/Check",
|
||||||
// ListenerPort: 21501,
|
ListenerPort: 21501,
|
||||||
// Protocol: "http2",
|
Protocol: "http2",
|
||||||
// }
|
}
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// // NOTE: if IPv6 is not supported in the kernel per
|
// NOTE: if IPv6 is not supported in the kernel per
|
||||||
// // kernelSupportsIPv6() then this test will fail because the golden
|
// kernelSupportsIPv6() then this test will fail because the golden
|
||||||
// // files were generated assuming ipv6 support was present
|
// files were generated assuming ipv6 support was present
|
||||||
// name: "expose-checks",
|
name: "expose-checks",
|
||||||
// create: proxycfg.TestConfigSnapshotExposeConfig,
|
create: proxycfg.TestConfigSnapshotExposeConfig,
|
||||||
// setup: func(snap *proxycfg.ConfigSnapshot) {
|
setup: func(snap *proxycfg.ConfigSnapshot) {
|
||||||
// snap.Proxy.Expose = structs.ExposeConfig{
|
snap.Proxy.Expose = structs.ExposeConfig{
|
||||||
// Checks: true,
|
Checks: true,
|
||||||
// }
|
}
|
||||||
// },
|
},
|
||||||
// serverSetup: func(s *Server) {
|
serverSetup: func(s *Server) {
|
||||||
// s.CfgFetcher = configFetcherFunc(func() string {
|
s.CfgFetcher = configFetcherFunc(func() string {
|
||||||
// return "192.0.2.1"
|
return "192.0.2.1"
|
||||||
// })
|
})
|
||||||
//
|
|
||||||
// s.CheckFetcher = httpCheckFetcherFunc(func(sid structs.ServiceID) []structs.CheckType {
|
s.CheckFetcher = httpCheckFetcherFunc(func(sid structs.ServiceID) []structs.CheckType {
|
||||||
// if sid != structs.NewServiceID("web", nil) {
|
if sid != structs.NewServiceID("web", nil) {
|
||||||
// return nil
|
return nil
|
||||||
// }
|
}
|
||||||
// return []structs.CheckType{{
|
return []structs.CheckType{{
|
||||||
// CheckID: types.CheckID("http"),
|
CheckID: types.CheckID("http"),
|
||||||
// Name: "http",
|
Name: "http",
|
||||||
// HTTP: "http://127.0.0.1:8181/debug",
|
HTTP: "http://127.0.0.1:8181/debug",
|
||||||
// ProxyHTTP: "http://:21500/debug",
|
ProxyHTTP: "http://:21500/debug",
|
||||||
// Method: "GET",
|
Method: "GET",
|
||||||
// Interval: 10 * time.Second,
|
Interval: 10 * time.Second,
|
||||||
// Timeout: 1 * time.Second,
|
Timeout: 1 * time.Second,
|
||||||
// }}
|
}}
|
||||||
// })
|
})
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// name: "mesh-gateway",
|
name: "mesh-gateway",
|
||||||
// create: proxycfg.TestConfigSnapshotMeshGateway,
|
create: proxycfg.TestConfigSnapshotMeshGateway,
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// name: "mesh-gateway-using-federation-states",
|
name: "mesh-gateway-using-federation-states",
|
||||||
// create: proxycfg.TestConfigSnapshotMeshGatewayUsingFederationStates,
|
create: proxycfg.TestConfigSnapshotMeshGatewayUsingFederationStates,
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// name: "mesh-gateway-no-services",
|
name: "mesh-gateway-no-services",
|
||||||
// create: proxycfg.TestConfigSnapshotMeshGatewayNoServices,
|
create: proxycfg.TestConfigSnapshotMeshGatewayNoServices,
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// name: "mesh-gateway-tagged-addresses",
|
name: "mesh-gateway-tagged-addresses",
|
||||||
// create: proxycfg.TestConfigSnapshotMeshGateway,
|
create: proxycfg.TestConfigSnapshotMeshGateway,
|
||||||
// setup: func(snap *proxycfg.ConfigSnapshot) {
|
setup: func(snap *proxycfg.ConfigSnapshot) {
|
||||||
// snap.Proxy.Config = map[string]interface{}{
|
snap.Proxy.Config = map[string]interface{}{
|
||||||
// "envoy_mesh_gateway_no_default_bind": true,
|
"envoy_mesh_gateway_no_default_bind": true,
|
||||||
// "envoy_mesh_gateway_bind_tagged_addresses": true,
|
"envoy_mesh_gateway_bind_tagged_addresses": true,
|
||||||
// }
|
}
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// name: "mesh-gateway-custom-addresses",
|
name: "mesh-gateway-custom-addresses",
|
||||||
// create: proxycfg.TestConfigSnapshotMeshGateway,
|
create: proxycfg.TestConfigSnapshotMeshGateway,
|
||||||
// setup: func(snap *proxycfg.ConfigSnapshot) {
|
setup: func(snap *proxycfg.ConfigSnapshot) {
|
||||||
// snap.Proxy.Config = map[string]interface{}{
|
snap.Proxy.Config = map[string]interface{}{
|
||||||
// "envoy_mesh_gateway_bind_addresses": map[string]structs.ServiceAddress{
|
"envoy_mesh_gateway_bind_addresses": map[string]structs.ServiceAddress{
|
||||||
// "foo": {
|
"foo": {
|
||||||
// Address: "198.17.2.3",
|
Address: "198.17.2.3",
|
||||||
// Port: 8080,
|
Port: 8080,
|
||||||
// },
|
},
|
||||||
// "bar": {
|
"bar": {
|
||||||
// Address: "2001:db8::ff",
|
Address: "2001:db8::ff",
|
||||||
// Port: 9999,
|
Port: 9999,
|
||||||
// },
|
},
|
||||||
// "baz": {
|
"baz": {
|
||||||
// Address: "127.0.0.1",
|
Address: "127.0.0.1",
|
||||||
// Port: 8765,
|
Port: 8765,
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// }
|
}
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// name: "ingress-gateway",
|
name: "ingress-gateway",
|
||||||
// create: proxycfg.TestConfigSnapshotIngressGateway,
|
create: proxycfg.TestConfigSnapshotIngressGateway,
|
||||||
// setup: nil,
|
setup: nil,
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// name: "ingress-gateway-bind-addrs",
|
name: "ingress-gateway-bind-addrs",
|
||||||
// create: proxycfg.TestConfigSnapshotIngressGateway,
|
create: proxycfg.TestConfigSnapshotIngressGateway,
|
||||||
// setup: func(snap *proxycfg.ConfigSnapshot) {
|
setup: func(snap *proxycfg.ConfigSnapshot) {
|
||||||
// snap.TaggedAddresses = map[string]structs.ServiceAddress{
|
snap.TaggedAddresses = map[string]structs.ServiceAddress{
|
||||||
// "lan": {Address: "10.0.0.1"},
|
"lan": {Address: "10.0.0.1"},
|
||||||
// "wan": {Address: "172.16.0.1"},
|
"wan": {Address: "172.16.0.1"},
|
||||||
// }
|
}
|
||||||
// snap.Proxy.Config = map[string]interface{}{
|
snap.Proxy.Config = map[string]interface{}{
|
||||||
// "envoy_gateway_no_default_bind": true,
|
"envoy_gateway_no_default_bind": true,
|
||||||
// "envoy_gateway_bind_tagged_addresses": true,
|
"envoy_gateway_bind_tagged_addresses": true,
|
||||||
// "envoy_gateway_bind_addresses": map[string]structs.ServiceAddress{
|
"envoy_gateway_bind_addresses": map[string]structs.ServiceAddress{
|
||||||
// "foo": {Address: "8.8.8.8"},
|
"foo": {Address: "8.8.8.8"},
|
||||||
// },
|
},
|
||||||
// }
|
}
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// name: "ingress-gateway-no-services",
|
name: "ingress-gateway-no-services",
|
||||||
// create: proxycfg.TestConfigSnapshotIngressGatewayNoServices,
|
create: proxycfg.TestConfigSnapshotIngressGatewayNoServices,
|
||||||
// setup: nil,
|
setup: nil,
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// name: "ingress-with-chain-external-sni",
|
name: "ingress-with-chain-external-sni",
|
||||||
// create: proxycfg.TestConfigSnapshotIngressExternalSNI,
|
create: proxycfg.TestConfigSnapshotIngressExternalSNI,
|
||||||
// setup: nil,
|
setup: nil,
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// name: "ingress-with-chain-and-overrides",
|
name: "ingress-with-chain-and-overrides",
|
||||||
// create: proxycfg.TestConfigSnapshotIngressWithOverrides,
|
create: proxycfg.TestConfigSnapshotIngressWithOverrides,
|
||||||
// setup: nil,
|
setup: nil,
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// name: "ingress-with-tcp-chain-failover-through-remote-gateway",
|
name: "ingress-with-tcp-chain-failover-through-remote-gateway",
|
||||||
// create: proxycfg.TestConfigSnapshotIngressWithFailoverThroughRemoteGateway,
|
create: proxycfg.TestConfigSnapshotIngressWithFailoverThroughRemoteGateway,
|
||||||
// setup: nil,
|
setup: nil,
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// name: "ingress-with-tcp-chain-failover-through-local-gateway",
|
name: "ingress-with-tcp-chain-failover-through-local-gateway",
|
||||||
// create: proxycfg.TestConfigSnapshotIngressWithFailoverThroughLocalGateway,
|
create: proxycfg.TestConfigSnapshotIngressWithFailoverThroughLocalGateway,
|
||||||
// setup: nil,
|
setup: nil,
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// name: "ingress-splitter-with-resolver-redirect",
|
name: "ingress-splitter-with-resolver-redirect",
|
||||||
// create: proxycfg.TestConfigSnapshotIngress_SplitterWithResolverRedirectMultiDC,
|
create: proxycfg.TestConfigSnapshotIngress_SplitterWithResolverRedirectMultiDC,
|
||||||
// setup: nil,
|
setup: nil,
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// name: "terminating-gateway",
|
name: "terminating-gateway",
|
||||||
// create: proxycfg.TestConfigSnapshotTerminatingGateway,
|
create: proxycfg.TestConfigSnapshotTerminatingGateway,
|
||||||
// setup: nil,
|
setup: nil,
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// name: "terminating-gateway-no-services",
|
name: "terminating-gateway-no-services",
|
||||||
// create: proxycfg.TestConfigSnapshotTerminatingGatewayNoServices,
|
create: proxycfg.TestConfigSnapshotTerminatingGatewayNoServices,
|
||||||
// setup: nil,
|
setup: nil,
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// name: "terminating-gateway-custom-and-tagged-addresses",
|
name: "terminating-gateway-custom-and-tagged-addresses",
|
||||||
// create: proxycfg.TestConfigSnapshotTerminatingGateway,
|
create: proxycfg.TestConfigSnapshotTerminatingGateway,
|
||||||
// setup: func(snap *proxycfg.ConfigSnapshot) {
|
setup: func(snap *proxycfg.ConfigSnapshot) {
|
||||||
// snap.Proxy.Config = map[string]interface{}{
|
snap.Proxy.Config = map[string]interface{}{
|
||||||
// "envoy_gateway_no_default_bind": true,
|
"envoy_gateway_no_default_bind": true,
|
||||||
// "envoy_gateway_bind_tagged_addresses": true,
|
"envoy_gateway_bind_tagged_addresses": true,
|
||||||
// "envoy_gateway_bind_addresses": map[string]structs.ServiceAddress{
|
"envoy_gateway_bind_addresses": map[string]structs.ServiceAddress{
|
||||||
// // This bind address should not get a listener due to deduplication and it sorts to the end
|
// This bind address should not get a listener due to deduplication and it sorts to the end
|
||||||
// "z-duplicate-of-tagged-wan-addr": {
|
"z-duplicate-of-tagged-wan-addr": {
|
||||||
// Address: "198.18.0.1",
|
Address: "198.18.0.1",
|
||||||
// Port: 443,
|
Port: 443,
|
||||||
// },
|
},
|
||||||
// "foo": {
|
"foo": {
|
||||||
// Address: "198.17.2.3",
|
Address: "198.17.2.3",
|
||||||
// Port: 8080,
|
Port: 8080,
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// }
|
}
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// name: "terminating-gateway-service-subsets",
|
name: "terminating-gateway-service-subsets",
|
||||||
// create: proxycfg.TestConfigSnapshotTerminatingGateway,
|
create: proxycfg.TestConfigSnapshotTerminatingGateway,
|
||||||
// setup: func(snap *proxycfg.ConfigSnapshot) {
|
setup: func(snap *proxycfg.ConfigSnapshot) {
|
||||||
// snap.TerminatingGateway.ServiceResolvers = map[structs.ServiceName]*structs.ServiceResolverConfigEntry{
|
snap.TerminatingGateway.ServiceResolvers = map[structs.ServiceName]*structs.ServiceResolverConfigEntry{
|
||||||
// structs.NewServiceName("web", nil): {
|
structs.NewServiceName("web", nil): {
|
||||||
// Kind: structs.ServiceResolver,
|
Kind: structs.ServiceResolver,
|
||||||
// Name: "web",
|
Name: "web",
|
||||||
// Subsets: map[string]structs.ServiceResolverSubset{
|
Subsets: map[string]structs.ServiceResolverSubset{
|
||||||
// "v1": {
|
"v1": {
|
||||||
// Filter: "Service.Meta.version == 1",
|
Filter: "Service.Meta.version == 1",
|
||||||
// },
|
},
|
||||||
// "v2": {
|
"v2": {
|
||||||
// Filter: "Service.Meta.version == 2",
|
Filter: "Service.Meta.version == 2",
|
||||||
// OnlyPassing: true,
|
OnlyPassing: true,
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// }
|
}
|
||||||
// snap.TerminatingGateway.ServiceConfigs[structs.NewServiceName("web", nil)] = &structs.ServiceConfigResponse{
|
snap.TerminatingGateway.ServiceConfigs[structs.NewServiceName("web", nil)] = &structs.ServiceConfigResponse{
|
||||||
// ProxyConfig: map[string]interface{}{"protocol": "http"},
|
ProxyConfig: map[string]interface{}{"protocol": "http"},
|
||||||
// }
|
}
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// name: "ingress-http-multiple-services",
|
name: "ingress-http-multiple-services",
|
||||||
// create: proxycfg.TestConfigSnapshotIngress_HTTPMultipleServices,
|
create: proxycfg.TestConfigSnapshotIngress_HTTPMultipleServices,
|
||||||
// setup: func(snap *proxycfg.ConfigSnapshot) {
|
setup: func(snap *proxycfg.ConfigSnapshot) {
|
||||||
// snap.IngressGateway.Upstreams = map[proxycfg.IngressListenerKey]structs.Upstreams{
|
snap.IngressGateway.Upstreams = map[proxycfg.IngressListenerKey]structs.Upstreams{
|
||||||
// {Protocol: "http", Port: 8080}: {
|
{Protocol: "http", Port: 8080}: {
|
||||||
// {
|
{
|
||||||
// DestinationName: "foo",
|
DestinationName: "foo",
|
||||||
// LocalBindPort: 8080,
|
LocalBindPort: 8080,
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// DestinationName: "bar",
|
DestinationName: "bar",
|
||||||
// LocalBindPort: 8080,
|
LocalBindPort: 8080,
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// {Protocol: "http", Port: 443}: {
|
{Protocol: "http", Port: 443}: {
|
||||||
// {
|
{
|
||||||
// DestinationName: "baz",
|
DestinationName: "baz",
|
||||||
// LocalBindPort: 443,
|
LocalBindPort: 443,
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// DestinationName: "qux",
|
DestinationName: "qux",
|
||||||
// LocalBindPort: 443,
|
LocalBindPort: 443,
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// }
|
}
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// name: "terminating-gateway-no-api-cert",
|
name: "terminating-gateway-no-api-cert",
|
||||||
// create: proxycfg.TestConfigSnapshotTerminatingGateway,
|
create: proxycfg.TestConfigSnapshotTerminatingGateway,
|
||||||
// setup: func(snap *proxycfg.ConfigSnapshot) {
|
setup: func(snap *proxycfg.ConfigSnapshot) {
|
||||||
// snap.TerminatingGateway.ServiceLeaves[structs.NewServiceName("api", nil)] = nil
|
snap.TerminatingGateway.ServiceLeaves[structs.NewServiceName("api", nil)] = nil
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// name: "ingress-with-tls-listener",
|
name: "ingress-with-tls-listener",
|
||||||
// create: proxycfg.TestConfigSnapshotIngressWithTLSListener,
|
create: proxycfg.TestConfigSnapshotIngressWithTLSListener,
|
||||||
// setup: nil,
|
setup: nil,
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
name: "transparent-proxy",
|
name: "transparent-proxy",
|
||||||
create: proxycfg.TestConfigSnapshot,
|
create: proxycfg.TestConfigSnapshot,
|
||||||
|
|
Loading…
Reference in New Issue