2021-05-12 12:38:18 +00:00
|
|
|
package admin
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2021-07-27 16:21:53 +00:00
|
|
|
"net/http"
|
2021-05-12 12:38:18 +00:00
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (suite *RadosGWTestSuite) TestUsage() {
|
|
|
|
suite.SetupConnection()
|
2021-07-27 16:21:53 +00:00
|
|
|
co, err := New(suite.endpoint, suite.accessKey, suite.secretKey, newDebugHTTPClient(http.DefaultClient))
|
2021-05-12 12:38:18 +00:00
|
|
|
assert.NoError(suite.T(), err)
|
|
|
|
|
|
|
|
suite.T().Run("get usage", func(t *testing.T) {
|
|
|
|
pTrue := true
|
|
|
|
usage, err := co.GetUsage(context.Background(), Usage{ShowSummary: &pTrue})
|
|
|
|
assert.NoError(suite.T(), err)
|
|
|
|
assert.NotEmpty(t, usage)
|
|
|
|
})
|
|
|
|
|
2024-02-13 06:19:38 +00:00
|
|
|
suite.T().Run("trim usage", func(_ *testing.T) {
|
2021-05-12 12:38:18 +00:00
|
|
|
pFalse := false
|
|
|
|
_, err := co.GetUsage(context.Background(), Usage{RemoveAll: &pFalse})
|
|
|
|
assert.NoError(suite.T(), err)
|
|
|
|
})
|
|
|
|
}
|