mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
api: add missing AllocDirStats field in Go API (#20261)
The JSON response for the Read Stats client API includes an `AllocDirStats` field. This field is missing in the `api` package, so consumers of the Go API can't use it to read the values we're getting back from the HTTP server. Fixes: https://github.com/hashicorp/nomad/issues/20246
This commit is contained in:
3
.changelog/20261.txt
Normal file
3
.changelog/20261.txt
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
```release-note:bug
|
||||||
|
api: Fixed a bug where `AllocDirStats` field was missing from Read Stats client API
|
||||||
|
```
|
||||||
@@ -783,6 +783,7 @@ type HostStats struct {
|
|||||||
Memory *HostMemoryStats
|
Memory *HostMemoryStats
|
||||||
CPU []*HostCPUStats
|
CPU []*HostCPUStats
|
||||||
DiskStats []*HostDiskStats
|
DiskStats []*HostDiskStats
|
||||||
|
AllocDirStats *HostDiskStats
|
||||||
DeviceStats []*DeviceGroupStats
|
DeviceStats []*DeviceGroupStats
|
||||||
Uptime uint64
|
Uptime uint64
|
||||||
CPUTicksConsumed float64
|
CPUTicksConsumed float64
|
||||||
|
|||||||
@@ -153,6 +153,27 @@ func TestNodes_Info(t *testing.T) {
|
|||||||
must.GreaterEq(t, 1, len(result.Events))
|
must.GreaterEq(t, 1, len(result.Events))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestNode_Stats(t *testing.T) {
|
||||||
|
testutil.Parallel(t)
|
||||||
|
|
||||||
|
c, s := makeClient(t, nil, func(c *testutil.TestServerConfig) {
|
||||||
|
c.DevMode = true
|
||||||
|
})
|
||||||
|
defer s.Stop()
|
||||||
|
nodesAPI := c.Nodes()
|
||||||
|
nodeID := oneNodeFromNodeList(t, nodesAPI).ID
|
||||||
|
|
||||||
|
stats, err := nodesAPI.Stats(nodeID, nil)
|
||||||
|
must.NoError(t, err)
|
||||||
|
|
||||||
|
// there isn't much we can reliably check here except that the values are
|
||||||
|
// populated
|
||||||
|
must.NotNil(t, stats.Memory)
|
||||||
|
must.NonZero(t, stats.Memory.Available)
|
||||||
|
must.NotNil(t, stats.AllocDirStats)
|
||||||
|
must.NonZero(t, stats.AllocDirStats.Size)
|
||||||
|
}
|
||||||
|
|
||||||
func TestNodes_NoSecretID(t *testing.T) {
|
func TestNodes_NoSecretID(t *testing.T) {
|
||||||
testutil.Parallel(t)
|
testutil.Parallel(t)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user