mirror of https://github.com/hashicorp/consul
Make routes controller tests more robust when testing with multiple tenancies (#20743)
When executing the test with multiple tenancies the various mesh controllers remained running across multiple sub-tests. While the resourcetest.Client cleans up resources created with it, resources created by the controllers were not being cleaned up. This could result in subsequent sub tests encountering unexpected values and failing when they should pass.pull/20751/head
parent
90d3a7c16d
commit
1a454b7b47
|
@ -42,7 +42,7 @@ type testResourceRef struct {
|
|||
barServiceRef *pbresource.Reference
|
||||
}
|
||||
|
||||
func (suite *controllerSuite) SetupTest() {
|
||||
func (suite *controllerSuite) SetupSubTest() {
|
||||
suite.ctx = testutil.TestContext(suite.T())
|
||||
suite.tenancies = rtest.TestTenancies()
|
||||
|
||||
|
@ -1349,7 +1349,7 @@ func (suite *controllerSuite) TestController() {
|
|||
|
||||
func (suite *controllerSuite) TestController_Failover() {
|
||||
for _, tenancy := range suite.tenancies {
|
||||
|
||||
suite.Run(suite.appendTenancyInfo(tenancy), func() {
|
||||
computedRoutesID := rtest.Resource(pbmesh.ComputedRoutesType, "api").
|
||||
WithTenancy(tenancy).
|
||||
ID()
|
||||
|
@ -1608,6 +1608,7 @@ func (suite *controllerSuite) TestController_Failover() {
|
|||
|
||||
lastVersion = requireNewComputedRoutesVersion(t, suite.client, computedRoutesID, lastVersion, expect)
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue