Skip to content

Commit

Permalink
backport of commit 78f9f17
Browse files Browse the repository at this point in the history
  • Loading branch information
tgross authored Apr 3, 2024
1 parent db4e8a1 commit 955d8d5
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/20261.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
api: Fixed a bug where `AllocDirStats` field was missing from Read Stats client API
```
1 change: 1 addition & 0 deletions api/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,7 @@ type HostStats struct {
Memory *HostMemoryStats
CPU []*HostCPUStats
DiskStats []*HostDiskStats
AllocDirStats *HostDiskStats
DeviceStats []*DeviceGroupStats
Uptime uint64
CPUTicksConsumed float64
Expand Down
21 changes: 21 additions & 0 deletions api/nodes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,27 @@ func TestNodes_Info(t *testing.T) {
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) {
testutil.Parallel(t)

Expand Down

0 comments on commit 955d8d5

Please sign in to comment.