From cba3b25196eb1f94ae0aed02074ec29a33be23e4 Mon Sep 17 00:00:00 2001 From: cskh Date: Fri, 12 Jan 2024 13:27:36 -0500 Subject: [PATCH] integ test: import missing changes from ent (#20187) --- test-integ/topoutil/asserter.go | 5 +++-- .../consul-container/libs/assert/envoy.go | 12 +++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/test-integ/topoutil/asserter.go b/test-integ/topoutil/asserter.go index 7765e20c6c..5e986a20d5 100644 --- a/test-integ/topoutil/asserter.go +++ b/test-integ/topoutil/asserter.go @@ -12,6 +12,9 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/hashicorp/consul/api" "github.com/hashicorp/consul/proto-public/pbresource" "github.com/hashicorp/consul/sdk/testutil" @@ -19,8 +22,6 @@ import ( 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/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 diff --git a/test/integration/consul-container/libs/assert/envoy.go b/test/integration/consul-container/libs/assert/envoy.go index 0d2929ab90..511c778670 100644 --- a/test/integration/consul-container/libs/assert/envoy.go +++ b/test/integration/consul-container/libs/assert/envoy.go @@ -14,11 +14,12 @@ import ( "testing" "time" - "github.com/hashicorp/consul/sdk/testutil/retry" "github.com/hashicorp/go-cleanhttp" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/hashicorp/consul/sdk/testutil/retry" + libcluster "github.com/hashicorp/consul/test/integration/consul-container/libs/cluster" "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 } +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 // 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]