github.com/telepresenceio/telepresence/v2@v2.20.0-pro.6.0.20240517030216-236ea954e789/integration_test/itest/traffic_manager.go (about) 1 package itest 2 3 import ( 4 "context" 5 "testing" 6 7 "github.com/stretchr/testify/assert" 8 "github.com/stretchr/testify/require" 9 ) 10 11 type trafficManager struct { 12 NamespacePair 13 } 14 15 func WithTrafficManager(np NamespacePair, f func(ctx context.Context, ch NamespacePair)) { 16 np.HarnessT().Run("Test_TrafficManager", func(t *testing.T) { 17 ctx := WithT(np.HarnessContext(), t) 18 require.NoError(t, np.GeneralError()) 19 th := &trafficManager{NamespacePair: np} 20 th.PushHarness(ctx, th.setup, th.tearDown) 21 defer th.PopHarness() 22 f(ctx, th) 23 }) 24 } 25 26 func (th *trafficManager) setup(ctx context.Context) bool { 27 t := getT(ctx) 28 TelepresenceQuitOk(ctx) 29 _, err := th.TelepresenceHelmInstall(ctx, false) 30 return assert.NoError(t, err) 31 } 32 33 func (th *trafficManager) tearDown(ctx context.Context) { 34 th.UninstallTrafficManager(ctx, th.ManagerNamespace()) 35 }