From cff9f271514a559f8d7d130dea7cdd5521a81973 Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Wed, 21 Feb 2018 15:42:48 -0500 Subject: [PATCH] 11645: Add tests that StorageClasses is loaded from config Arvados-DCO-1.1-Signed-off-by: Peter Amstutz --- services/keepstore/azure_blob_volume_test.go | 13 +++++++++++++ services/keepstore/s3_volume_test.go | 13 +++++++++++++ services/keepstore/volume_unix_test.go | 13 +++++++++++++ 3 files changed, 39 insertions(+) diff --git a/services/keepstore/azure_blob_volume_test.go b/services/keepstore/azure_blob_volume_test.go index 5c6e2ab44c..60a7911768 100644 --- a/services/keepstore/azure_blob_volume_test.go +++ b/services/keepstore/azure_blob_volume_test.go @@ -27,6 +27,7 @@ import ( "time" "github.com/Azure/azure-sdk-for-go/storage" + "github.com/ghodss/yaml" check "gopkg.in/check.v1" ) @@ -707,6 +708,18 @@ func (s *StubbedAzureBlobSuite) TestStats(c *check.C) { c.Check(stats(), check.Matches, `.*"InBytes":6,.*`) } +func (s *StubbedAzureBlobSuite) TestConfig(c *check.C) { + var cfg Config + err := yaml.Unmarshal([]byte(` +Volumes: + - Type: Azure + 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 *TestableAzureBlobVolume) PutRaw(locator string, data []byte) { v.azHandler.PutRaw(v.ContainerName, locator, data) } diff --git a/services/keepstore/s3_volume_test.go b/services/keepstore/s3_volume_test.go index acc1b11df3..4081e1e63c 100644 --- a/services/keepstore/s3_volume_test.go +++ b/services/keepstore/s3_volume_test.go @@ -19,6 +19,7 @@ import ( "git.curoverse.com/arvados.git/sdk/go/arvados" "github.com/AdRoll/goamz/s3" "github.com/AdRoll/goamz/s3/s3test" + "github.com/ghodss/yaml" check "gopkg.in/check.v1" ) @@ -435,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) diff --git a/services/keepstore/volume_unix_test.go b/services/keepstore/volume_unix_test.go index ea3d91d98c..7f1cd21964 100644 --- a/services/keepstore/volume_unix_test.go +++ b/services/keepstore/volume_unix_test.go @@ -19,6 +19,7 @@ import ( "testing" "time" + "github.com/ghodss/yaml" check "gopkg.in/check.v1" ) @@ -427,3 +428,15 @@ func (s *UnixVolumeSuite) TestStats(c *check.C) { c.Check(err, check.IsNil) c.Check(stats(), check.Matches, `.*"FlockOps":2,.*`) } + +func (s *UnixVolumeSuite) TestConfig(c *check.C) { + var cfg Config + err := yaml.Unmarshal([]byte(` +Volumes: + - Type: Directory + StorageClasses: ["class_a", "class_b"] +`), &cfg) + + c.Check(err, check.IsNil) + c.Check(cfg.Volumes[0].GetStorageClasses(), check.DeepEquals, []string{"class_a", "class_b"}) +} -- 2.30.2