Skip to content

Commit

Permalink
fix: give time to device volume to acquire space
Browse files Browse the repository at this point in the history
  • Loading branch information
Nabil-Salah committed Dec 4, 2024
1 parent 7c941ca commit 9621dac
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 0 additions & 2 deletions pkg/storage/filesystem/btrfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,7 @@ func (p *btrfsPool) Usage() (usage Usage, err error) {

usage.Size = p.device.Size

fmt.Println("we here")
for _, volume := range volumes {
fmt.Printf("%v\n", volume)
vol, err := volume.Usage()
if err != nil {
return Usage{}, errors.Wrapf(err, "failed to calculate volume '%s' usage", volume.Path())
Expand Down
3 changes: 2 additions & 1 deletion pkg/storage/filesystem/btrfs_ci_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"path"
"strings"
"testing"
"time"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -166,6 +167,7 @@ func basePoolTest(t *testing.T, pool Pool) {
assert.Len(t, volumes, 1)
})

time.Sleep(30 * time.Second)
t.Run("test usage", func(t *testing.T) {
usage, err := pool.Usage()
require.NoError(t, err)
Expand All @@ -185,7 +187,6 @@ func basePoolTest(t *testing.T, pool Pool) {
usage, err = volume.Usage()
require.NoError(t, err)

// Note: an empty subvolume has an overhead of 16384 bytes
assert.Equal(t, Usage{Used: 50 * 1024 * 1024, Size: 50 * 1024 * 1024}, usage)
})

Expand Down

0 comments on commit 9621dac

Please sign in to comment.