+ // vols[0].Touch will fail on the next call, so the volume
+ // manager will store a copy on vols[1] instead.
+ vols[0].(*MockVolume).Touchable = false
+ if n, err := PutBlock(TestBlock, TestHash); err != nil || n < 1 {
+ t.Fatalf("PutBlock: n %d err %v", n, err)
+ }
+ vols[0].(*MockVolume).Touchable = true
+
+ // Now the mtime on the block on vols[0] should be unchanged, and
+ // there should be a copy of the block on vols[1].
+ newMtime, err := vols[0].Mtime(TestHash)
+ if err != nil {
+ t.Fatalf("vols[0].Mtime(%s): %s\n", TestHash, err)
+ }
+ if !newMtime.Equal(oldMtime) {
+ t.Errorf("mtime was changed on vols[0]:\noldMtime = %v\nnewMtime = %v\n",
+ oldMtime, newMtime)
+ }
+ result, err := vols[1].Get(TestHash)
+ if err != nil {
+ t.Fatalf("vols[1]: %v", err)
+ }
+ if bytes.Compare(result, TestBlock) != 0 {
+ t.Errorf("new block does not match test block\nnew block = %v\n", result)
+ }
+}
+
+func TestDiscoverTmpfs(t *testing.T) {
+ var tempVols [4]string
+ var err error
+
+ // Create some directories suitable for using as keep volumes.