Refactor the multi-host salt install page.
[arvados.git] / services / keepstore / volume_test.go
index a928a71a2c0315a7666bb4f9ede138e3403d24cf..950b3989aa0f6a72e20553f8505f6575a91b39c4 100644 (file)
@@ -2,7 +2,7 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-package main
+package keepstore
 
 import (
        "bytes"
@@ -148,7 +148,7 @@ func (v *MockVolume) Compare(ctx context.Context, loc string, buf []byte) error
                }
                return nil
        } else {
-               return NotFoundError
+               return os.ErrNotExist
        }
 }
 
@@ -178,13 +178,20 @@ func (v *MockVolume) Put(ctx context.Context, loc string, block []byte) error {
 }
 
 func (v *MockVolume) Touch(loc string) error {
+       return v.TouchWithDate(loc, time.Now())
+}
+
+func (v *MockVolume) TouchWithDate(loc string, t time.Time) error {
        v.gotCall("Touch")
        <-v.Gate
        if v.volume.ReadOnly {
                return MethodDisabledError
        }
+       if _, exists := v.Store[loc]; !exists {
+               return os.ErrNotExist
+       }
        if v.Touchable {
-               v.Timestamps[loc] = time.Now()
+               v.Timestamps[loc] = t
                return nil
        }
        return errors.New("Touch failed")