From 56889d6cd4df125d9eba111a588adae5b77cdc5d Mon Sep 17 00:00:00 2001 From: Cian Johnston Date: Mon, 17 Jul 2023 17:24:46 +0100 Subject: [PATCH] fix(cli): unskip TestStatCPUCmd/JSON and explicitly set --host in test cmd invocation (#8558) - Un-skips TestStatCPUCmd/JSON - Explicitly sets --host flag when running the cli tests for the stat command as when these are invoked inside a container without a CPU or memory limit set, these tests may fail. --- cli/stat_test.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cli/stat_test.go b/cli/stat_test.go index f955ccdb60..d92574e339 100644 --- a/cli/stat_test.go +++ b/cli/stat_test.go @@ -85,8 +85,6 @@ func TestStatCPUCmd(t *testing.T) { t.Run("JSON", func(t *testing.T) { t.Parallel() - t.Skip("https://github.com/coder/coder/issues/8091") - ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitShort) t.Cleanup(cancel) inv, _ := clitest.New(t, "stat", "cpu", "--output=json") @@ -111,7 +109,7 @@ func TestStatMemCmd(t *testing.T) { t.Parallel() ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitShort) t.Cleanup(cancel) - inv, _ := clitest.New(t, "stat", "mem", "--output=text") + inv, _ := clitest.New(t, "stat", "mem", "--output=text", "--host") buf := new(bytes.Buffer) inv.Stdout = buf err := inv.WithContext(ctx).Run() @@ -124,7 +122,7 @@ func TestStatMemCmd(t *testing.T) { t.Parallel() ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitShort) t.Cleanup(cancel) - inv, _ := clitest.New(t, "stat", "mem", "--output=json") + inv, _ := clitest.New(t, "stat", "mem", "--output=json", "--host") buf := new(bytes.Buffer) inv.Stdout = buf err := inv.WithContext(ctx).Run()