|
6 | 6 | "testing" |
7 | 7 | "time" |
8 | 8 |
|
| 9 | + inventorytest "github.com/gophercloud/gophercloud/openstack/baremetal/inventory/testing" |
9 | 10 | "github.com/gophercloud/gophercloud/openstack/baremetal/v1/nodes" |
10 | 11 | th "github.com/gophercloud/gophercloud/testhelper" |
11 | 12 | "github.com/gophercloud/gophercloud/testhelper/client" |
@@ -813,6 +814,20 @@ const NodeSetMaintenanceBody = ` |
813 | 814 | } |
814 | 815 | ` |
815 | 816 |
|
| 817 | +var NodeInventoryBody = fmt.Sprintf(` |
| 818 | +{ |
| 819 | + "inventory": %s, |
| 820 | + "plugin_data":{ |
| 821 | + "macs":[ |
| 822 | + "52:54:00:90:35:d6" |
| 823 | + ], |
| 824 | + "local_gb":10, |
| 825 | + "cpu_arch":"x86_64", |
| 826 | + "memory_mb":2048 |
| 827 | + } |
| 828 | +} |
| 829 | +`, inventorytest.InventorySample) |
| 830 | + |
816 | 831 | var ( |
817 | 832 | createdAtFoo, _ = time.Parse(time.RFC3339, "2019-01-31T19:59:28+00:00") |
818 | 833 | createdAtBar, _ = time.Parse(time.RFC3339, "2019-01-31T19:59:29+00:00") |
@@ -1173,6 +1188,10 @@ var ( |
1173 | 1188 | EventTypes: []string{"Alert"}, |
1174 | 1189 | Protocol: "Redfish", |
1175 | 1190 | } |
| 1191 | + |
| 1192 | + NodeInventoryData = nodes.InventoryData{ |
| 1193 | + Inventory: inventorytest.Inventory, |
| 1194 | + } |
1176 | 1195 | ) |
1177 | 1196 |
|
1178 | 1197 | // HandleNodeListSuccessfully sets up the test server to respond to a server List request. |
@@ -1568,3 +1587,13 @@ func HandleUnsetNodeMaintenanceSuccessfully(t *testing.T) { |
1568 | 1587 | w.WriteHeader(http.StatusAccepted) |
1569 | 1588 | }) |
1570 | 1589 | } |
| 1590 | + |
| 1591 | +// HandleGetInventorySuccessfully sets up the test server to respond to a get inventory request for a node |
| 1592 | +func HandleGetInventorySuccessfully(t *testing.T) { |
| 1593 | + th.Mux.HandleFunc("/nodes/1234asdf/inventory", func(w http.ResponseWriter, r *http.Request) { |
| 1594 | + th.TestMethod(t, r, "GET") |
| 1595 | + th.TestHeader(t, r, "X-Auth-Token", client.TokenID) |
| 1596 | + w.WriteHeader(http.StatusOK) |
| 1597 | + fmt.Fprintf(w, NodeInventoryBody) |
| 1598 | + }) |
| 1599 | +} |
0 commit comments