diff --git a/command/rtt.go b/command/rtt.go index 4b4d26e3c..2e71941b1 100644 --- a/command/rtt.go +++ b/command/rtt.go @@ -10,13 +10,13 @@ import ( "github.com/mitchellh/cli" ) -// RttCommand is a Command implementation that allows users to query the +// RTTCommand is a Command implementation that allows users to query the // estimated round trip time between nodes using network coordinates. -type RttCommand struct { +type RTTCommand struct { Ui cli.Ui } -func (c *RttCommand) Help() string { +func (c *RTTCommand) Help() string { helpText := ` Usage: consul rtt [options] node1 [node2] @@ -44,7 +44,7 @@ Options: return strings.TrimSpace(helpText) } -func (c *RttCommand) Run(args []string) int { +func (c *RTTCommand) Run(args []string) int { var wan bool cmdFlags := flag.NewFlagSet("rtt", flag.ContinueOnError) @@ -56,7 +56,7 @@ func (c *RttCommand) Run(args []string) int { return 1 } - // They must provide a pair of nodes. + // They must provide at least one node. nodes := cmdFlags.Args() if len(nodes) < 1 || len(nodes) > 2 { c.Ui.Error("One or two node names must be specified") @@ -179,6 +179,6 @@ SHOW_RTT: return 0 } -func (c *RttCommand) Synopsis() string { +func (c *RTTCommand) Synopsis() string { return "Estimates network round trip time between nodes" } diff --git a/command/rtt_test.go b/command/rtt_test.go index 9b387e916..f1e928cfb 100644 --- a/command/rtt_test.go +++ b/command/rtt_test.go @@ -12,13 +12,13 @@ import ( "github.com/mitchellh/cli" ) -func TestRttCommand_Implements(t *testing.T) { - var _ cli.Command = &RttCommand{} +func TestRTTCommand_Implements(t *testing.T) { + var _ cli.Command = &RTTCommand{} } -func TestRttCommand_Run_BadArgs(t *testing.T) { +func TestRTTCommand_Run_BadArgs(t *testing.T) { ui := new(cli.MockUi) - c := &RttCommand{Ui: ui} + c := &RTTCommand{Ui: ui} if code := c.Run([]string{}); code != 1 { t.Fatalf("expected return code 1, got %d", code) @@ -41,7 +41,7 @@ func TestRttCommand_Run_BadArgs(t *testing.T) { } } -func TestRttCommand_Run_LAN(t *testing.T) { +func TestRTTCommand_Run_LAN(t *testing.T) { updatePeriod := 10 * time.Millisecond a := testAgentWithConfig(t, func(c *agent.Config) { c.ConsulConfig.CoordinateUpdatePeriod = updatePeriod @@ -80,7 +80,7 @@ func TestRttCommand_Run_LAN(t *testing.T) { // Try two known nodes. { ui := new(cli.MockUi) - c := &RttCommand{Ui: ui} + c := &RTTCommand{Ui: ui} args := []string{ "-http-addr=" + a.httpAddr, a.config.NodeName, @@ -101,7 +101,7 @@ func TestRttCommand_Run_LAN(t *testing.T) { // Default to the agent's node. { ui := new(cli.MockUi) - c := &RttCommand{Ui: ui} + c := &RTTCommand{Ui: ui} args := []string{ "-http-addr=" + a.httpAddr, "dogs", @@ -121,7 +121,7 @@ func TestRttCommand_Run_LAN(t *testing.T) { // Try an unknown node. { ui := new(cli.MockUi) - c := &RttCommand{Ui: ui} + c := &RTTCommand{Ui: ui} args := []string{ "-http-addr=" + a.httpAddr, a.config.NodeName, @@ -134,7 +134,7 @@ func TestRttCommand_Run_LAN(t *testing.T) { } } -func TestRttCommand_Run_WAN(t *testing.T) { +func TestRTTCommand_Run_WAN(t *testing.T) { a := testAgent(t) defer a.Shutdown() waitForLeader(t, a.httpAddr) @@ -145,7 +145,7 @@ func TestRttCommand_Run_WAN(t *testing.T) { // node with itself. { ui := new(cli.MockUi) - c := &RttCommand{Ui: ui} + c := &RTTCommand{Ui: ui} args := []string{ "-wan", "-http-addr=" + a.httpAddr, @@ -166,7 +166,7 @@ func TestRttCommand_Run_WAN(t *testing.T) { // Default to the agent's node. { ui := new(cli.MockUi) - c := &RttCommand{Ui: ui} + c := &RTTCommand{Ui: ui} args := []string{ "-wan", "-http-addr=" + a.httpAddr, @@ -186,7 +186,7 @@ func TestRttCommand_Run_WAN(t *testing.T) { // Try an unknown node. { ui := new(cli.MockUi) - c := &RttCommand{Ui: ui} + c := &RTTCommand{Ui: ui} args := []string{ "-wan", "-http-addr=" + a.httpAddr, diff --git a/commands.go b/commands.go index 592cad236..57c640ab5 100644 --- a/commands.go +++ b/commands.go @@ -115,7 +115,7 @@ func init() { }, "rtt": func() (cli.Command, error) { - return &command.RttCommand{ + return &command.RTTCommand{ Ui: ui, }, nil },