test: assert HostVolumes included in ListNodes

This commit is contained in:
Michael Schurter
2020-03-30 12:16:04 -07:00
committed by Michael Lange
parent 21b8986139
commit 624625e83a

View File

@@ -2663,6 +2663,13 @@ func TestClientEndpoint_ListNodes(t *testing.T) {
// Create the register request
node := mock.Node()
node.HostVolumes = map[string]*structs.ClientHostVolumeConfig{
"foo": {
Name: "foo",
Path: "/",
ReadOnly: true,
},
}
reg := &structs.NodeRegisterRequest{
Node: node,
WriteRequest: structs.WriteRequest{Region: "global"},
@@ -2688,12 +2695,11 @@ func TestClientEndpoint_ListNodes(t *testing.T) {
t.Fatalf("Bad index: %d %d", resp2.Index, resp.Index)
}
if len(resp2.Nodes) != 1 {
t.Fatalf("bad: %#v", resp2.Nodes)
}
if resp2.Nodes[0].ID != node.ID {
t.Fatalf("bad: %#v", resp2.Nodes[0])
}
require.Len(t, resp2.Nodes, 1)
require.Equal(t, node.ID, resp2.Nodes[0].ID)
// #7344 - Assert HostVolumes are included in stub
require.Equal(t, node.HostVolumes, resp2.Nodes[0].HostVolumes)
// Lookup the node with prefix
get = &structs.NodeListRequest{