go-ceph/rgw/admin/quota_test.go
Sébastien Han a2c50e28a5 rgw/admin: add quota support
This commit introduces support for user and bucket quota on the rgw
admin ops API.

Co-authored-by: Irek Fasikhov malmyzh@gmail.com
Co-authored-by: Quentin Perez qperez42@gmail.com
Signed-off-by: Sébastien Han <seb@redhat.com>
2021-06-07 12:23:46 -04:00

29 lines
757 B
Go

package admin
import (
"context"
"testing"
"github.com/stretchr/testify/assert"
)
func (suite *RadosGWTestSuite) TestQuota() {
suite.SetupConnection()
co, err := New(suite.endpoint, suite.accessKey, suite.secretKey, nil)
co.Debug = true
assert.NoError(suite.T(), err)
suite.T().Run("set quota to user but user ID is empty", func(t *testing.T) {
err := co.SetUserQuota(context.Background(), QuotaSpec{})
assert.Error(suite.T(), err)
assert.EqualError(suite.T(), err, errMissingUserID.Error())
})
suite.T().Run("get user quota but no user is specified", func(t *testing.T) {
_, err := co.GetUserQuota(context.Background(), QuotaSpec{})
assert.Error(suite.T(), err)
assert.EqualError(suite.T(), err, errMissingUserID.Error())
})
}