Move test setup out of subtest (#19753)

This commit is contained in:
Chris S. Kim 2023-11-28 13:39:37 -05:00 committed by GitHub
parent 991dfff8a5
commit 5107764115
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 9 deletions

View File

@ -6,19 +6,19 @@ package sidecarproxy
import ( import (
"context" "context"
"fmt" "fmt"
mockres "github.com/hashicorp/consul/agent/grpc-external/services/resource"
"github.com/hashicorp/consul/internal/mesh/internal/controllers/routes/routestest"
"strings" "strings"
"testing" "testing"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite" "github.com/stretchr/testify/suite"
mockres "github.com/hashicorp/consul/agent/grpc-external/services/resource"
svctest "github.com/hashicorp/consul/agent/grpc-external/services/resource/testing" svctest "github.com/hashicorp/consul/agent/grpc-external/services/resource/testing"
"github.com/hashicorp/consul/envoyextensions/xdscommon" "github.com/hashicorp/consul/envoyextensions/xdscommon"
"github.com/hashicorp/consul/internal/auth" "github.com/hashicorp/consul/internal/auth"
"github.com/hashicorp/consul/internal/catalog" "github.com/hashicorp/consul/internal/catalog"
"github.com/hashicorp/consul/internal/controller" "github.com/hashicorp/consul/internal/controller"
"github.com/hashicorp/consul/internal/mesh/internal/controllers/routes/routestest"
"github.com/hashicorp/consul/internal/mesh/internal/controllers/sidecarproxy/builder" "github.com/hashicorp/consul/internal/mesh/internal/controllers/sidecarproxy/builder"
"github.com/hashicorp/consul/internal/mesh/internal/controllers/sidecarproxy/cache" "github.com/hashicorp/consul/internal/mesh/internal/controllers/sidecarproxy/cache"
"github.com/hashicorp/consul/internal/mesh/internal/controllers/sidecarproxy/fetcher" "github.com/hashicorp/consul/internal/mesh/internal/controllers/sidecarproxy/fetcher"
@ -577,13 +577,11 @@ func (suite *controllerTestSuite) TestController() {
webComputedDestinations *pbresource.Resource webComputedDestinations *pbresource.Resource
) )
testutil.RunStep(suite.T(), "proxy state template generation", func(t *testing.T) { // Check that proxy state template resource is generated for both the api and web workloads.
// Check that proxy state template resource is generated for both the api and web workloads. retry.Run(suite.T(), func(r *retry.R) {
retry.Run(t, func(r *retry.R) { suite.client.RequireResourceExists(r, apiProxyStateTemplateID)
suite.client.RequireResourceExists(r, apiProxyStateTemplateID) webProxyStateTemplate = suite.client.RequireResourceExists(r, webProxyStateTemplateID)
webProxyStateTemplate = suite.client.RequireResourceExists(r, webProxyStateTemplateID) apiProxyStateTemplate = suite.client.RequireResourceExists(r, apiProxyStateTemplateID)
apiProxyStateTemplate = suite.client.RequireResourceExists(r, apiProxyStateTemplateID)
})
}) })
// Write a default ComputedRoutes for api. // Write a default ComputedRoutes for api.