github.com/ilhicas/nomad@v0.11.8/command/system_gc_test.go (about)

     1  package command
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/mitchellh/cli"
     7  )
     8  
     9  func TestSystemGCCommand_Implements(t *testing.T) {
    10  	t.Parallel()
    11  	var _ cli.Command = &SystemGCCommand{}
    12  }
    13  
    14  func TestSystemGCCommand_Good(t *testing.T) {
    15  	t.Parallel()
    16  
    17  	// Create a server
    18  	srv, _, url := testServer(t, true, nil)
    19  	defer srv.Shutdown()
    20  
    21  	ui := new(cli.MockUi)
    22  	cmd := &SystemGCCommand{Meta: Meta{Ui: ui, flagAddress: url}}
    23  
    24  	if code := cmd.Run([]string{"-address=" + url}); code != 0 {
    25  		t.Fatalf("expected exit 0, got: %d; %v", code, ui.ErrorWriter.String())
    26  	}
    27  }