mirror of https://github.com/ceph/go-ceph
rgw/admin: add test for bucket creation date
This commit is contained in:
parent
f9dc7c1dcf
commit
9531dd692a
|
@ -5,6 +5,7 @@ import (
|
|||
"errors"
|
||||
"net/http"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/ceph/go-ceph/internal/util"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
@ -18,6 +19,7 @@ func (suite *RadosGWTestSuite) TestBucket() {
|
|||
s3, err := newS3Agent(suite.accessKey, suite.secretKey, suite.endpoint, true)
|
||||
assert.NoError(suite.T(), err)
|
||||
|
||||
beforeCreate := time.Now()
|
||||
err = s3.createBucket(suite.bucketTestName)
|
||||
assert.NoError(suite.T(), err)
|
||||
|
||||
|
@ -38,6 +40,13 @@ func (suite *RadosGWTestSuite) TestBucket() {
|
|||
assert.NoError(suite.T(), err)
|
||||
})
|
||||
|
||||
suite.T().Run("existing bucket has valid creation date", func(_ *testing.T) {
|
||||
b, err := co.GetBucketInfo(context.Background(), Bucket{Bucket: suite.bucketTestName})
|
||||
assert.NoError(suite.T(), err)
|
||||
assert.NotNil(suite.T(), b.CreationTime)
|
||||
assert.WithinDuration(suite.T(), beforeCreate, *b.CreationTime, time.Minute)
|
||||
})
|
||||
|
||||
suite.T().Run("get policy non-existing bucket", func(_ *testing.T) {
|
||||
_, err := co.GetBucketPolicy(context.Background(), Bucket{Bucket: "foo"})
|
||||
assert.Error(suite.T(), err)
|
||||
|
|
Loading…
Reference in New Issue