github.com/hernad/nomad@v1.6.112/command/system_gc_test.go (about)

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