Add namespace file with build tag for OSS gateway tests (#16590)

* Add namespace file with build tag for OSS tests

* Remove TODO comment
This commit is contained in:
John Maguire 2023-03-09 15:46:02 -05:00 committed by GitHub
parent 00caa78594
commit 7bd248d432
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 13 deletions

View File

@ -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)

View File

@ -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)

View File

@ -0,0 +1,8 @@
//go:build !consulent
// +build !consulent
package gateways
func getNamespace() string {
return ""
}