2020-01-13 10:34:46 +00:00
|
|
|
package command
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2022-03-15 12:42:43 +00:00
|
|
|
"github.com/hashicorp/nomad/ci"
|
2020-01-13 10:34:46 +00:00
|
|
|
"github.com/mitchellh/cli"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestSystemGCCommand_Implements(t *testing.T) {
|
2022-03-15 12:42:43 +00:00
|
|
|
ci.Parallel(t)
|
2020-01-13 10:34:46 +00:00
|
|
|
var _ cli.Command = &SystemGCCommand{}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestSystemGCCommand_Good(t *testing.T) {
|
2022-03-15 12:42:43 +00:00
|
|
|
ci.Parallel(t)
|
2020-01-13 10:34:46 +00:00
|
|
|
|
|
|
|
// Create a server
|
|
|
|
srv, _, url := testServer(t, true, nil)
|
|
|
|
defer srv.Shutdown()
|
|
|
|
|
2020-10-05 14:07:41 +00:00
|
|
|
ui := cli.NewMockUi()
|
2021-06-28 08:57:50 +00:00
|
|
|
cmd := &SystemGCCommand{Meta: Meta{Ui: ui}}
|
2020-01-13 10:34:46 +00:00
|
|
|
|
|
|
|
if code := cmd.Run([]string{"-address=" + url}); code != 0 {
|
|
|
|
t.Fatalf("expected exit 0, got: %d; %v", code, ui.ErrorWriter.String())
|
|
|
|
}
|
|
|
|
}
|