From 1e41f7ebf4f46494f7dcbecb659abee13464cab5 Mon Sep 17 00:00:00 2001 From: Fabio Mendes Date: Wed, 27 Apr 2022 15:43:13 -0400 Subject: [PATCH] Fixing the test --- cmd/kaf/main_test.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/cmd/kaf/main_test.go b/cmd/kaf/main_test.go index 4cfc3a8..1091239 100644 --- a/cmd/kaf/main_test.go +++ b/cmd/kaf/main_test.go @@ -2,12 +2,10 @@ package main import ( "bytes" - "context" "io" "io/ioutil" "os" "testing" - "time" "github.com/orlangure/gnomock" "github.com/orlangure/gnomock/preset/kafka" @@ -42,8 +40,8 @@ func testMain(m *testing.M) (code int) { } func runCmd(t *testing.T, in io.Reader, args ...string) string { - ctx, cancel := context.WithTimeout(context.Background(), time.Second*2) - defer cancel() + // ctx, cancel := context.WithTimeout(context.Background(), time.Second*2) + // defer cancel() b := bytes.NewBufferString("") @@ -52,7 +50,7 @@ func runCmd(t *testing.T, in io.Reader, args ...string) string { rootCmd.SetErr(b) rootCmd.SetIn(in) - require.NoError(t, rootCmd.ExecuteContext(ctx)) + require.NoError(t, rootCmd.Execute()) bs, err := ioutil.ReadAll(b) require.NoError(t, err)