github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/command/system_gc_test.go (about)

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