Fix flaky test TestServiceGet
@@ -41,11 +41,12 @@ func (NoopVolume) CreatedAt() (time.Time, error) { return time.Now(), nil }
type FakeVolume struct {
name string
driverName string
+ createdAt time.Time
}
// NewFakeVolume creates a new fake volume for testing
func NewFakeVolume(name string, driverName string) volume.Volume {
- return FakeVolume{name: name, driverName: driverName}
+ return FakeVolume{name: name, driverName: driverName, createdAt: time.Now()}
}
// Name is the name of the volume
@@ -69,7 +70,9 @@ func (FakeVolume) Status() map[string]interface{} {
}
// CreatedAt provides the time the volume (directory) was created at
-func (FakeVolume) CreatedAt() (time.Time, error) { return time.Now(), nil }
+func (f FakeVolume) CreatedAt() (time.Time, error) {
+ return f.createdAt, nil
+}
// FakeDriver is a driver that generates fake volumes
type FakeDriver struct {
