diff --git a/flytectl/cmd/demo/exec_test.go b/flytectl/cmd/demo/exec_test.go index f671b5ae59..6c8c0b2a93 100644 --- a/flytectl/cmd/demo/exec_test.go +++ b/flytectl/cmd/demo/exec_test.go @@ -53,6 +53,8 @@ func TestSandboxClusterExecWithoutCmd(t *testing.T) { mockDocker := &mocks.Docker{} reader := bufio.NewReader(strings.NewReader("test")) s := testutils.Setup() + defer s.RestoreStandardFileDescriptors() + ctx := s.Ctx mockDocker.OnContainerList(ctx, types.ContainerListOptions{All: true}).Return([]types.Container{ diff --git a/flytectl/cmd/demo/status_test.go b/flytectl/cmd/demo/status_test.go index 538ea29469..a09a48c1d0 100644 --- a/flytectl/cmd/demo/status_test.go +++ b/flytectl/cmd/demo/status_test.go @@ -15,6 +15,7 @@ func TestDemoStatus(t *testing.T) { t.Run("Demo status with zero result", func(t *testing.T) { mockDocker := &mocks.Docker{} s := testutils.Setup() + defer s.RestoreStandardFileDescriptors() mockDocker.OnContainerList(s.Ctx, types.ContainerListOptions{All: true}).Return([]types.Container{}, nil) docker.Client = mockDocker err := demoClusterStatus(s.Ctx, []string{}, s.CmdCtx) @@ -22,6 +23,7 @@ func TestDemoStatus(t *testing.T) { }) t.Run("Demo status with running", func(t *testing.T) { s := testutils.Setup() + defer s.RestoreStandardFileDescriptors() ctx := s.Ctx mockDocker := &mocks.Docker{} mockDocker.OnContainerList(ctx, types.ContainerListOptions{All: true}).Return([]types.Container{ diff --git a/flytectl/cmd/demo/teardown_test.go b/flytectl/cmd/demo/teardown_test.go index ba808e5c69..ea78fddb33 100644 --- a/flytectl/cmd/demo/teardown_test.go +++ b/flytectl/cmd/demo/teardown_test.go @@ -80,6 +80,8 @@ func TestTearDownClusterFunc(t *testing.T) { _ = util.SetupFlyteDir() _ = util.WriteIntoFile([]byte("data"), configutil.FlytectlConfig) s := testutils.Setup() + defer s.RestoreStandardFileDescriptors() + ctx := s.Ctx mockDocker := &mocks.Docker{} mockDocker.OnContainerList(ctx, types.ContainerListOptions{All: true}).Return(containers, nil) diff --git a/flytectl/pkg/sandbox/status_test.go b/flytectl/pkg/sandbox/status_test.go index bf7345554a..b6dcedb2e4 100644 --- a/flytectl/pkg/sandbox/status_test.go +++ b/flytectl/pkg/sandbox/status_test.go @@ -15,12 +15,14 @@ func TestSandboxStatus(t *testing.T) { t.Run("Sandbox status with zero result", func(t *testing.T) { mockDocker := &mocks.Docker{} s := testutils.Setup() + defer s.RestoreStandardFileDescriptors() mockDocker.OnContainerList(s.Ctx, types.ContainerListOptions{All: true}).Return([]types.Container{}, nil) err := PrintStatus(s.Ctx, mockDocker) assert.Nil(t, err) }) t.Run("Sandbox status with running sandbox", func(t *testing.T) { s := testutils.Setup() + defer s.RestoreStandardFileDescriptors() ctx := s.Ctx mockDocker := &mocks.Docker{} mockDocker.OnContainerList(ctx, types.ContainerListOptions{All: true}).Return([]types.Container{