Skip to content

Commit

Permalink
Merge pull request moby#49284 from thaJeztah/test_statsresponse
Browse files Browse the repository at this point in the history
use StatsResponse instead of Stats in tests
  • Loading branch information
thaJeztah authored Jan 16, 2025
2 parents 57c5972 + 16cbb27 commit 1153242
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion integration-cli/docker_api_containers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func (s *DockerAPISuite) TestGetContainerStats(c *testing.T) {
case sr := <-bc:
dec := json.NewDecoder(sr.stats.Body)
defer sr.stats.Body.Close()
var s *container.Stats
var s *container.StatsResponse
// decode only one object from the stream
assert.NilError(c, dec.Decode(&s))
}
Expand Down
4 changes: 2 additions & 2 deletions integration-cli/docker_api_stats_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (s *DockerAPISuite) TestAPIStatsNoStreamGetCpu(c *testing.T) {
assert.Equal(c, resp.Header.Get("Content-Type"), "application/json")
assert.Equal(c, resp.Header.Get("Content-Type"), "application/json")

var v *container.Stats
var v *container.StatsResponse
err = json.NewDecoder(body).Decode(&v)
assert.NilError(c, err)
body.Close()
Expand Down Expand Up @@ -263,7 +263,7 @@ func (s *DockerAPISuite) TestAPIStatsNoStreamConnectedContainers(c *testing.T) {
if resp.Header.Get("Content-Type") != "application/json" {
ch <- fmt.Errorf("Invalid 'Content-Type' %v", resp.Header.Get("Content-Type"))
}
var v *container.Stats
var v *container.StatsResponse
if err := json.NewDecoder(body).Decode(&v); err != nil {
ch <- err
}
Expand Down
2 changes: 1 addition & 1 deletion integration-cli/docker_cli_update_unix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ func (s *DockerCLIUpdateSuite) TestUpdateStats(c *testing.T) {
assert.NilError(c, err)
assert.Equal(c, resp.Header.Get("Content-Type"), "application/json")

var v *container.Stats
var v *container.StatsResponse
err = json.NewDecoder(body).Decode(&v)
assert.NilError(c, err)
body.Close()
Expand Down
4 changes: 2 additions & 2 deletions integration/container/stats_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestStats(t *testing.T) {
assert.NilError(t, err)
defer resp.Body.Close()

var v containertypes.Stats
var v containertypes.StatsResponse
err = json.NewDecoder(resp.Body).Decode(&v)
assert.NilError(t, err)
assert.Check(t, is.Equal(int64(v.MemoryStats.Limit), info.MemTotal))
Expand All @@ -40,7 +40,7 @@ func TestStats(t *testing.T) {
assert.NilError(t, err)
defer resp.Body.Close()

v = containertypes.Stats{}
v = containertypes.StatsResponse{}
err = json.NewDecoder(resp.Body).Decode(&v)
assert.NilError(t, err)
assert.Check(t, is.Equal(int64(v.MemoryStats.Limit), info.MemTotal))
Expand Down

0 comments on commit 1153242

Please sign in to comment.