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.
This commit is contained in:
Cian Johnston
2023-07-17 17:24:46 +01:00
committed by GitHub
parent 854643236a
commit 56889d6cd4
+2 -4
View File
@@ -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()