-
Notifications
You must be signed in to change notification settings - Fork 245
/
Copy pathstore_mock.go
60 lines (46 loc) · 1.34 KB
/
store_mock.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//go:build !ignore_uncovered
// +build !ignore_uncovered
package testutils
import (
"time"
"github.com/Azure/azure-container-networking/store"
)
var _ store.KeyValueStore = (*KeyValueStoreMock)(nil)
type KeyValueStoreMock struct {
ExistsBool bool
ReadError error
WriteError error
FlushError error
LockError error
UnlockError error
ModificationTime time.Time
GetModificationTimeError error
}
func (mockst *KeyValueStoreMock) Exists() bool {
return mockst.ExistsBool
}
func (mockst *KeyValueStoreMock) Read(key string, value interface{}) error {
return mockst.ReadError
}
func (mockst *KeyValueStoreMock) Write(key string, value interface{}) error {
return mockst.WriteError
}
func (mockst *KeyValueStoreMock) Flush() error {
return mockst.FlushError
}
func (mockst *KeyValueStoreMock) Lock(time.Duration) error {
return mockst.LockError
}
func (mockst *KeyValueStoreMock) Unlock() error {
return mockst.UnlockError
}
func (mockst *KeyValueStoreMock) GetModificationTime() (time.Time, error) {
if mockst.GetModificationTimeError != nil {
return time.Time{}, mockst.GetModificationTimeError
}
return mockst.ModificationTime, nil
}
func (mockst *KeyValueStoreMock) Remove() {}
func (mockst *KeyValueStoreMock) Dump() (string, error) {
return "", nil
}