Skip to content

Commit 59eaa08

Browse files
committed
fix: TestCLeanUpQgroupsCI test
1 parent ebe8ea7 commit 59eaa08

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

pkg/storage/filesystem/btrfs.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,9 @@ func (p *btrfsPool) Usage() (usage Usage, err error) {
257257

258258
usage.Size = p.device.Size
259259

260+
fmt.Println("we here")
260261
for _, volume := range volumes {
262+
fmt.Printf("%v\n", volume)
261263
vol, err := volume.Usage()
262264
if err != nil {
263265
return Usage{}, errors.Wrapf(err, "failed to calculate volume '%s' usage", volume.Path())

pkg/storage/filesystem/btrfs_ci_test.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,7 @@ func basePoolTest(t *testing.T, pool Pool) {
158158

159159
assert.Equal(t, path.Join("/mnt", pool.Name(), "subvol1"), volume.Path())
160160
})
161-
defer func() {
162-
err := pool.RemoveVolume("subvol1")
163-
require.NoError(t, err)
164-
}()
161+
165162

166163
t.Run("test list volumes", func(t *testing.T) {
167164
volumes, err := pool.Volumes()
@@ -190,7 +187,7 @@ func basePoolTest(t *testing.T, pool Pool) {
190187
require.NoError(t, err)
191188

192189
// Note: an empty subvolume has an overhead of 16384 bytes
193-
assert.Equal(t, Usage{Used: 16384, Size: 50 * 1024 * 1024}, usage)
190+
assert.Equal(t, Usage{Used: 50*1024*1024, Size: 50 * 1024 * 1024}, usage)
194191
})
195192

196193
t.Run("test remove subvolume", func(t *testing.T) {
@@ -259,7 +256,9 @@ func TestCLeanUpQgroupsCI(t *testing.T) {
259256

260257
qgroups, err := btrfsVol.utils.QGroupList(context.TODO(), pool.Path())
261258
require.NoError(t, err)
262-
assert.Equal(t, 1, len(qgroups))
259+
260+
// it start with a volume of size 16384 by default
261+
assert.Equal(t, 2, len(qgroups))
263262
t.Logf("qgroups before delete: %v", qgroups)
264263

265264
_, ok = qgroups[fmt.Sprintf("0/%d", btrfsVol.id)]
@@ -272,5 +271,5 @@ func TestCLeanUpQgroupsCI(t *testing.T) {
272271
require.NoError(t, err)
273272

274273
t.Logf("remaining qgroups: %+v", qgroups)
275-
assert.Equal(t, 0, len(qgroups), "qgroups should have been deleted with the subvolume")
274+
assert.Equal(t, 1, len(qgroups), "qgroups should have been deleted with the subvolume")
276275
}

0 commit comments

Comments
 (0)