From 7bd248d4325e09e4e8c0ce8ff81c2b43f48775b9 Mon Sep 17 00:00:00 2001 From: John Maguire Date: Thu, 9 Mar 2023 15:46:02 -0500 Subject: [PATCH] Add namespace file with build tag for OSS gateway tests (#16590) * Add namespace file with build tag for OSS tests * Remove TODO comment --- .../test/gateways/gateway_endpoint_test.go | 9 +++++---- .../test/gateways/http_route_test.go | 15 ++++++--------- .../test/gateways/namespace_oss.go | 8 ++++++++ 3 files changed, 19 insertions(+), 13 deletions(-) create mode 100644 test/integration/consul-container/test/gateways/namespace_oss.go diff --git a/test/integration/consul-container/test/gateways/gateway_endpoint_test.go b/test/integration/consul-container/test/gateways/gateway_endpoint_test.go index e088222c5..9b0ed15bb 100644 --- a/test/integration/consul-container/test/gateways/gateway_endpoint_test.go +++ b/test/integration/consul-container/test/gateways/gateway_endpoint_test.go @@ -83,10 +83,11 @@ func TestAPIGatewayCreate(t *testing.T) { // Create a client proxy instance with the server as an upstream _, gatewayService := createServices(t, cluster, listenerPortOne) - //make sure the gateway/route come online - //make sure config entries have been properly created - checkGatewayConfigEntry(t, client, "api-gateway", "") - checkTCPRouteConfigEntry(t, client, "api-gateway-route", "") + // make sure the gateway/route come online + // make sure config entries have been properly created + namespace := getNamespace() + checkGatewayConfigEntry(t, client, "api-gateway", namespace) + checkTCPRouteConfigEntry(t, client, "api-gateway-route", namespace) port, err := gatewayService.GetPort(listenerPortOne) require.NoError(t, err) diff --git a/test/integration/consul-container/test/gateways/http_route_test.go b/test/integration/consul-container/test/gateways/http_route_test.go index ef05f8c3f..f0f958688 100644 --- a/test/integration/consul-container/test/gateways/http_route_test.go +++ b/test/integration/consul-container/test/gateways/http_route_test.go @@ -5,21 +5,19 @@ import ( "crypto/rand" "encoding/hex" "fmt" + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/hashicorp/consul/api" libassert "github.com/hashicorp/consul/test/integration/consul-container/libs/assert" libcluster "github.com/hashicorp/consul/test/integration/consul-container/libs/cluster" libservice "github.com/hashicorp/consul/test/integration/consul-container/libs/service" libtopology "github.com/hashicorp/consul/test/integration/consul-container/libs/topology" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "testing" - "time" ) -func getNamespace() string { - return "" -} - // randomName generates a random name of n length with the provided // prefix. If prefix is omitted, the then entire name is random char. func randomName(prefix string, n int) string { @@ -80,7 +78,6 @@ func TestHTTPRouteFlattening(t *testing.T) { }, ) - //TODO this should only matter in consul enterprise I believe? namespace := getNamespace() gatewayName := randomName("gw", 16) routeOneName := randomName("route", 16) diff --git a/test/integration/consul-container/test/gateways/namespace_oss.go b/test/integration/consul-container/test/gateways/namespace_oss.go new file mode 100644 index 000000000..3867e7298 --- /dev/null +++ b/test/integration/consul-container/test/gateways/namespace_oss.go @@ -0,0 +1,8 @@ +//go:build !consulent +// +build !consulent + +package gateways + +func getNamespace() string { + return "" +}