integ test: import missing changes from ent (#20187)

This commit is contained in:
cskh 2024-01-12 13:27:36 -05:00 committed by GitHub
parent 326c0ecfbe
commit cba3b25196
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 3 deletions

View File

@ -12,6 +12,9 @@ import (
"testing" "testing"
"time" "time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/hashicorp/consul/api" "github.com/hashicorp/consul/api"
"github.com/hashicorp/consul/proto-public/pbresource" "github.com/hashicorp/consul/proto-public/pbresource"
"github.com/hashicorp/consul/sdk/testutil" "github.com/hashicorp/consul/sdk/testutil"
@ -19,8 +22,6 @@ import (
libassert "github.com/hashicorp/consul/test/integration/consul-container/libs/assert" libassert "github.com/hashicorp/consul/test/integration/consul-container/libs/assert"
"github.com/hashicorp/consul/test/integration/consul-container/libs/utils" "github.com/hashicorp/consul/test/integration/consul-container/libs/utils"
"github.com/hashicorp/consul/testing/deployer/topology" "github.com/hashicorp/consul/testing/deployer/topology"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
) )
// Asserter is a utility to help in reducing boilerplate in invoking test // Asserter is a utility to help in reducing boilerplate in invoking test

View File

@ -14,11 +14,12 @@ import (
"testing" "testing"
"time" "time"
"github.com/hashicorp/consul/sdk/testutil/retry"
"github.com/hashicorp/go-cleanhttp" "github.com/hashicorp/go-cleanhttp"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/hashicorp/consul/sdk/testutil/retry"
libcluster "github.com/hashicorp/consul/test/integration/consul-container/libs/cluster" libcluster "github.com/hashicorp/consul/test/integration/consul-container/libs/cluster"
"github.com/hashicorp/consul/test/integration/consul-container/libs/utils" "github.com/hashicorp/consul/test/integration/consul-container/libs/utils"
) )
@ -356,6 +357,15 @@ func GetEnvoyOutputWithClient(client *http.Client, addr string, path string, que
return string(body), statusCode, nil return string(body), statusCode, nil
} }
func ResetEnvoyCounters(client *http.Client, addr string) (int, error) {
var u url.URL
u.Host = addr
u.Scheme = "http"
res, err := client.Post(fmt.Sprintf("%s/reset_counters", u.String()), "application/json", nil)
return res.StatusCode, err
}
// sanitizeResult takes the value returned from config_dump json and cleans it up to remove special characters // sanitizeResult takes the value returned from config_dump json and cleans it up to remove special characters
// e.g public_listener:0.0.0.0:21001 envoy.filters.network.rbac,envoy.filters.network.tcp_proxy // e.g public_listener:0.0.0.0:21001 envoy.filters.network.rbac,envoy.filters.network.tcp_proxy
// returns [envoy.filters.network.rbac envoy.filters.network.tcp_proxy] // returns [envoy.filters.network.rbac envoy.filters.network.tcp_proxy]