Rename "status" command to "server-status"
This commit is contained in:
parent
98eea89484
commit
f8e594cb39
8 changed files with 125 additions and 122 deletions
|
@ -61,10 +61,10 @@ func (s Server) Request(method, path string, in, out interface{}) error {
|
|||
|
||||
var serv = Server(os.Getenv("ROVE_HTTP"))
|
||||
|
||||
func TestServer_Status(t *testing.T) {
|
||||
req := &rove.StatusRequest{}
|
||||
resp := &rove.StatusResponse{}
|
||||
if err := serv.Request("GET", "status", req, resp); err != nil {
|
||||
func TestServer_ServerStatus(t *testing.T) {
|
||||
req := &rove.ServerStatusRequest{}
|
||||
resp := &rove.ServerStatusResponse{}
|
||||
if err := serv.Request("GET", "server-status", req, resp); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,8 +10,8 @@ import (
|
|||
)
|
||||
|
||||
// Status returns the status of the current server to a gRPC request
|
||||
func (s *Server) Status(context.Context, *rove.StatusRequest) (*rove.StatusResponse, error) {
|
||||
response := &rove.StatusResponse{
|
||||
func (s *Server) ServerStatus(context.Context, *rove.ServerStatusRequest) (*rove.ServerStatusResponse, error) {
|
||||
response := &rove.ServerStatusResponse{
|
||||
Ready: true,
|
||||
Version: version.Version,
|
||||
Tick: int32(s.tick),
|
||||
|
|
|
@ -27,7 +27,7 @@ var defaultDataPath = path.Join(home, ".local/share/")
|
|||
func printUsage() {
|
||||
fmt.Fprintf(os.Stderr, "Usage: rove COMMAND [ARGS...]\n")
|
||||
fmt.Fprintln(os.Stderr, "\nCommands")
|
||||
fmt.Fprintln(os.Stderr, "\tstatus prints the server status")
|
||||
fmt.Fprintln(os.Stderr, "\tserver-status prints the server status")
|
||||
fmt.Fprintln(os.Stderr, "\tregister NAME registers an account and stores it (use with -name)")
|
||||
fmt.Fprintln(os.Stderr, "\tcommands COMMAND [VAL...] issue commands to rover, accepts multiple, see below")
|
||||
fmt.Fprintln(os.Stderr, "\tradar gathers radar data for the current rover")
|
||||
|
@ -163,8 +163,8 @@ func InnerMain(command string, args ...string) error {
|
|||
|
||||
// Handle all the commands
|
||||
switch command {
|
||||
case "status":
|
||||
response, err := client.Status(ctx, &rove.StatusRequest{})
|
||||
case "server-status":
|
||||
response, err := client.ServerStatus(ctx, &rove.ServerStatusRequest{})
|
||||
switch {
|
||||
case err != nil:
|
||||
return err
|
||||
|
|
|
@ -26,11 +26,11 @@ func Test_InnerMain(t *testing.T) {
|
|||
}
|
||||
|
||||
// First attempt should error without a host
|
||||
assert.Error(t, InnerMain("status"))
|
||||
assert.Error(t, InnerMain("server-status"))
|
||||
|
||||
// Set the host in the config
|
||||
assert.NoError(t, InnerMain("config", address))
|
||||
assert.NoError(t, InnerMain("status"))
|
||||
assert.NoError(t, InnerMain("server-status"))
|
||||
|
||||
// Register should fail without a name
|
||||
assert.Error(t, InnerMain("register"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue