mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
fix: clean the output writter to avoid duplicates when testing for json output (#16619)
This commit is contained in:
committed by
GitHub
parent
cd4c3c9eb4
commit
7f5d19e3a0
@@ -52,7 +52,7 @@ func TestQuotaInspectCommand_Run(t *testing.T) {
|
||||
// Create a quota to delete
|
||||
qs := testQuotaSpec()
|
||||
_, err := client.Quotas().Register(qs, nil)
|
||||
must.NoError(t, err)
|
||||
must.NoError(t, err, must.Sprint("unexpected error:", err))
|
||||
|
||||
// Delete a quota
|
||||
code := cmd.Run([]string{"-address=" + url, qs.Name})
|
||||
@@ -63,12 +63,13 @@ func TestQuotaInspectCommand_Run(t *testing.T) {
|
||||
t.Fatalf("expected quota, got: %s", out)
|
||||
}
|
||||
|
||||
ui.OutputWriter.Reset()
|
||||
// List json
|
||||
must.Zero(t, cmd.Run([]string{"-address=" + url, "-json", qs.Name}))
|
||||
|
||||
outJson := api.QuotaSpec{}
|
||||
err = json.Unmarshal(ui.OutputWriter.Bytes(), &outJson)
|
||||
must.NoError(t, err)
|
||||
must.NoError(t, err, must.Sprint("unexpected error:", err))
|
||||
|
||||
ui.OutputWriter.Reset()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user