github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/pkg/util/disk/usage_test.go (about) 1 package disk 2 3 import ( 4 . "github.com/onsi/ginkgo/v2" 5 . "github.com/onsi/gomega" 6 7 "github.com/pyroscope-io/pyroscope/pkg/config" 8 "github.com/pyroscope-io/pyroscope/pkg/testing" 9 ) 10 11 var _ = Describe("disk package", func() { 12 var ( 13 u UsageStats 14 err error 15 ) 16 testing.WithConfig(func(cfg **config.Config) { 17 BeforeEach(func() { 18 u, err = Usage((*cfg).Server.StoragePath) 19 }) 20 Describe("Usage", func() { 21 It("doesn't return an error", func() { 22 Expect(err).To(Not(HaveOccurred())) 23 }) 24 25 It("returns non-zero Total", func() { 26 Expect(u.Total).To(BeNumerically(">", 0)) 27 }) 28 29 It("returns non-zero Available", func() { 30 Expect(u.Available).To(BeNumerically(">", 0)) 31 }) 32 33 It("returns Available < Total", func() { 34 Expect(u.Available).To(BeNumerically("<", u.Total)) 35 }) 36 }) 37 }) 38 })