X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/bdb92619b5f6d920119b8c32c3027cf4b751ed16..911abf131639401b2ccfd23a6bc3ec983f7ed8f4:/services/keepstore/s3_volume_test.go diff --git a/services/keepstore/s3_volume_test.go b/services/keepstore/s3_volume_test.go index c43b85b1c5..10c71125df 100644 --- a/services/keepstore/s3_volume_test.go +++ b/services/keepstore/s3_volume_test.go @@ -1,3 +1,7 @@ +// Copyright (C) The Arvados Authors. All rights reserved. +// +// SPDX-License-Identifier: AGPL-3.0 + package main import ( @@ -15,7 +19,7 @@ import ( "git.curoverse.com/arvados.git/sdk/go/arvados" "github.com/AdRoll/goamz/s3" "github.com/AdRoll/goamz/s3/s3test" - log "github.com/Sirupsen/logrus" + "github.com/ghodss/yaml" check "gopkg.in/check.v1" ) @@ -351,7 +355,7 @@ func (s *StubbedS3Suite) TestBackendStates(c *check.C) { } // Call Trash, then check canTrash and canGetAfterTrash - loc, blk = setupScenario() + loc, _ = setupScenario() err = v.Trash(loc) c.Check(err == nil, check.Equals, scenario.canTrash) _, err = v.Get(context.Background(), loc, buf) @@ -361,7 +365,7 @@ func (s *StubbedS3Suite) TestBackendStates(c *check.C) { } // Call Untrash, then check canUntrash - loc, blk = setupScenario() + loc, _ = setupScenario() err = v.Untrash(loc) c.Check(err == nil, check.Equals, scenario.canUntrash) if scenario.dataT != none || scenario.trashT != none { @@ -375,7 +379,7 @@ func (s *StubbedS3Suite) TestBackendStates(c *check.C) { // Call EmptyTrash, then check haveTrashAfterEmpty and // freshAfterEmpty - loc, blk = setupScenario() + loc, _ = setupScenario() v.EmptyTrash() _, err = v.bucket.Head("trash/"+loc, nil) c.Check(err == nil, check.Equals, scenario.haveTrashAfterEmpty) @@ -432,6 +436,18 @@ func (s *StubbedS3Suite) newTestableVolume(c *check.C, raceWindow time.Duration, return v } +func (s *StubbedS3Suite) TestConfig(c *check.C) { + var cfg Config + err := yaml.Unmarshal([]byte(` +Volumes: + - Type: S3 + StorageClasses: ["class_a", "class_b"] +`), &cfg) + + c.Check(err, check.IsNil) + c.Check(cfg.Volumes[0].GetStorageClasses(), check.DeepEquals, []string{"class_a", "class_b"}) +} + func (v *TestableS3Volume) Start() error { tmp, err := ioutil.TempFile("", "keepstore") v.c.Assert(err, check.IsNil) @@ -451,7 +467,11 @@ func (v *TestableS3Volume) Start() error { func (v *TestableS3Volume) PutRaw(loc string, block []byte) { err := v.bucket.Put(loc, block, "application/octet-stream", s3ACL, s3.Options{}) if err != nil { - log.Printf("PutRaw: %+v", err) + log.Printf("PutRaw: %s: %+v", loc, err) + } + err = v.bucket.Put("recent/"+loc, nil, "application/octet-stream", s3ACL, s3.Options{}) + if err != nil { + log.Printf("PutRaw: recent/%s: %+v", loc, err) } }