integration: fix disk usage test for c8d#46570
Conversation
87cb322 to
a2f7bdc
Compare
vvoland
left a comment
There was a problem hiding this comment.
Looks good! I just have some nits.
| assert.Equal(t, len(du.Images[0].RepoTags), 1) | ||
| assert.Equal(t, du.Images[0].RepoTags[0], "busybox:latest") | ||
|
|
||
| //Image size is layer size + content size, should be greater than total layer size |
There was a problem hiding this comment.
| //Image size is layer size + content size, should be greater than total layer size | |
| // Image size is layer size + content size, should be greater than total layer size |
| BuildCache: []*types.BuildCache{}, | ||
| }) | ||
| assert.Equal(t, len(du.Images[0].RepoTags), 1) | ||
| assert.Equal(t, du.Images[0].RepoTags[0], "busybox:latest") |
There was a problem hiding this comment.
| assert.Equal(t, du.Images[0].RepoTags[0], "busybox:latest") | |
| assert.Check(t, is.Equal(du.Images[0].RepoTags[0], "busybox:latest")) |
There was a problem hiding this comment.
We tend to use gotest.tools/v3/assert/cmp-style asserts whenever it's possible.
| // If size is greater, than content exists and should have a repodigest | ||
| if du.Images[0].Size > du.LayersSize { | ||
| assert.Equal(t, len(du.Images[0].RepoDigests), 1) | ||
| assert.Assert(t, strings.HasPrefix(du.Images[0].RepoDigests[0], "busybox@")) |
There was a problem hiding this comment.
If an assertion failure is "safe" (won't cause a panic later), it's better to use assert.Check instead of assert.Assert as it won't abort immediately and will continue with other asserts.
| assert.Equal(t, du.Containers[0].Image, "busybox") | ||
| assert.Equal(t, du.Containers[0].ImageID, prev.Images[0].ID) | ||
|
|
||
| // The rootfs size shouldbe equivalent to all the layers, |
There was a problem hiding this comment.
| // The rootfs size shouldbe equivalent to all the layers, | |
| // The rootfs size should be equivalent to all the layers, |
|
Does this fully fix the issue? I see in https://github.com/moby/moby/actions/runs/6506688442/job/17672826153 that the Nevermind, that's probably due to something else broken that didn't get cleaned up properly. |
Check for accurate values that may contain content sizes unknown to the usage test in the calculation. Avoid asserting using deep equals when only the expected value range is known to the test. Signed-off-by: Derek McGowan <derek@mcg.dev>
a2f7bdc to
e97716a
Compare
Check for accurate values that may contain content sizes unknown to the usage test in the calculation. Avoid asserting using deep equals when only the expected value range is known to the test.
Always use familiarized string in images output.