diff --git a/nomad/client_rpc_test.go b/nomad/client_rpc_test.go index 932da59d2..2a5020195 100644 --- a/nomad/client_rpc_test.go +++ b/nomad/client_rpc_test.go @@ -142,4 +142,5 @@ func TestServerWithNodeConn_NoPathAndErr(t *testing.T) { srv, err := s1.serverWithNodeConn(uuid.Generate()) require.Nil(srv) require.NotNil(err) + require.Contains(err.Error(), "failed querying") } diff --git a/nomad/client_stats_endpoint.go b/nomad/client_stats_endpoint.go index f7e1cc07f..7bc92b937 100644 --- a/nomad/client_stats_endpoint.go +++ b/nomad/client_stats_endpoint.go @@ -80,6 +80,10 @@ func (s *ClientStats) Stats(args *structs.ClientStatsRequest, reply *structs.Cli return err } + if srv == nil { + return ErrNoNodeConn + } + return s.srv.forwardServer(srv, "ClientStats.Stats", args, reply) }