Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport of api: add missing AllocDirStats field in Go API into release/1.6.x #20272

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -783,6 +783,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 @@ -153,6 +153,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
Loading