8555: Test Get() after successful Untrash. Test Put+Mtime in all scenarios.
authorTom Clegg <tom@curoverse.com>
Tue, 26 Jul 2016 16:25:35 +0000 (12:25 -0400)
committerTom Clegg <tom@curoverse.com>
Wed, 27 Jul 2016 19:22:07 +0000 (15:22 -0400)
services/keepstore/s3_volume_test.go

index e41e04b36323e6ff250795d6c1a7a2728a490c1a..65ce2beb205ff51a83944f8c7622a3dab6a7fd56 100644 (file)
@@ -270,6 +270,14 @@ func (s *StubbedS3Suite) TestBackendStates(c *check.C) {
                loc, blk = setupScenario()
                err = v.Untrash(loc)
                c.Check(err == nil, check.Equals, scenario.canUntrash)
+               if scenario.dataT != none || scenario.trashT != none {
+                       // In all scenarios where the data exists, we
+                       // should be able to Get after Untrash --
+                       // regardless of timestamps, errors, race
+                       // conditions, etc.
+                       _, err = v.Get(loc, buf)
+                       c.Check(err, check.IsNil)
+               }
 
                loc, blk = setupScenario()
                v.EmptyTrash()
@@ -282,6 +290,13 @@ func (s *StubbedS3Suite) TestBackendStates(c *check.C) {
                        // allowance for 1s timestamp precision)
                        c.Check(t.After(t0.Add(-time.Second)), check.Equals, true)
                }
+
+               loc, blk = setupScenario()
+               err = v.Put(loc, blk)
+               c.Check(err, check.IsNil)
+               t, err := v.Mtime(loc)
+               c.Check(err, check.IsNil)
+               c.Check(t.After(t0.Add(-time.Second)), check.Equals, true)
        }
 }