aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMuhammad Talal Anwar <talalanwar@outlook.com>2018-09-06 14:53:01 +0200
committerMuhammad Talal Anwar <talalanwar@outlook.com>2018-09-06 14:53:01 +0200
commit127cfdcd847fef24f606b5c548fe90dc2b46549e (patch)
treeb1f569017bfa2dab4f3f0cb5fcc96fabce9c548d
parentbc05e125f4850bedbe19c5ab29d4767139c846df (diff)
downloadgo-schwift-127cfdcd847fef24f606b5c548fe90dc2b46549e.tar.gz
add test for segment expiration
-rw-r--r--tests/largeobject_test.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/largeobject_test.go b/tests/largeobject_test.go
index dc8ed9d..1932741 100644
--- a/tests/largeobject_test.go
+++ b/tests/largeobject_test.go
@@ -143,9 +143,7 @@ func TestLargeObjectsBasic(t *testing.T) {
func TestLargeObjectExpiration(t *testing.T) {
testWithContainer(t, func(c *schwift.Container) {
foreachLargeObjectStrategy(func(strategy schwift.LargeObjectStrategy, strategyStr string) {
- segment1 := getRandomSegmentContent(128)
- segment2 := getRandomSegmentContent(128)
-
+ segment := getRandomSegmentContent(128)
obj := c.Object(strategyStr + "-largeobject")
lo, err := obj.AsNewLargeObject(schwift.SegmentingOptions{
SegmentContainer: c,
@@ -159,7 +157,7 @@ func TestLargeObjectExpiration(t *testing.T) {
headers := schwift.NewObjectHeaders()
headers.ExpiresAt().Set(expirationTime)
- expectSuccess(t, lo.Append(bytes.NewReader([]byte(segment1+segment2)), 128, headers.ToOpts()))
+ expectSuccess(t, lo.Append(bytes.NewReader([]byte(segment)), 128, headers.ToOpts()))
expectSuccess(t, lo.WriteManifest(headers.ToOpts()))
//check object expiration
@@ -169,6 +167,10 @@ func TestLargeObjectExpiration(t *testing.T) {
expectString(t, objectExpiration, expirationTime.Format("2006-01-02 15:04:05 +00:00 MST"))
//check segment expiration
+ hdr, err = c.Object(strategyStr + "-segments/0000000000000001").Headers()
+ expectSuccess(t, err)
+ objectExpiration = hdr.ExpiresAt().Get().Format("2006-01-02 15:04:05 +00:00 MST")
+ expectString(t, objectExpiration, expirationTime.Format("2006-01-02 15:04:05 +00:00 MST"))
})
})