mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 10:25:42 +03:00
Unit test for dev agent
This commit is contained in:
@@ -322,7 +322,7 @@ func (a *Agent) clientConfig() (*clientconfig.Config, error) {
|
||||
conf.Servers = a.config.Client.Servers
|
||||
if a.server != nil {
|
||||
conf.Servers = append(conf.Servers,
|
||||
a.config.Addresses.RPC,
|
||||
a.config.normalizedAddrs.RPC,
|
||||
a.config.AdvertiseAddrs.RPC)
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,9 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
cstructs "github.com/hashicorp/nomad/client/structs"
|
||||
"github.com/hashicorp/nomad/helper"
|
||||
"github.com/hashicorp/nomad/nomad/structs"
|
||||
sconfig "github.com/hashicorp/nomad/nomad/structs/config"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
@@ -1057,3 +1059,24 @@ func TestServer_ShouldReload_ShouldHandleMultipleChanges(t *testing.T) {
|
||||
require.False(shouldReloadRPC)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAgent_ProxyRPC_Dev(t *testing.T) {
|
||||
t.Parallel()
|
||||
agent := NewTestAgent(t, t.Name(), nil)
|
||||
defer agent.Shutdown()
|
||||
|
||||
id := agent.client.NodeID()
|
||||
req := &structs.NodeSpecificRequest{
|
||||
NodeID: id,
|
||||
QueryOptions: structs.QueryOptions{
|
||||
Region: agent.server.Region(),
|
||||
},
|
||||
}
|
||||
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
|
||||
var resp cstructs.ClientStatsResponse
|
||||
if err := agent.RPC("ClientStats.Stats", req, &resp); err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user