...
1
16
17 package testing
18
19 import (
20 "context"
21 "time"
22
23 "k8s.io/apimachinery/pkg/types"
24 "k8s.io/kubernetes/pkg/kubelet/container"
25 )
26
27 type fakeCache struct {
28 runtime container.Runtime
29 }
30
31 func NewFakeCache(runtime container.Runtime) container.Cache {
32 return &fakeCache{runtime: runtime}
33 }
34
35 func (c *fakeCache) Get(id types.UID) (*container.PodStatus, error) {
36 return c.runtime.GetPodStatus(context.Background(), id, "", "")
37 }
38
39 func (c *fakeCache) GetNewerThan(id types.UID, minTime time.Time) (*container.PodStatus, error) {
40 return c.Get(id)
41 }
42
43 func (c *fakeCache) Set(id types.UID, status *container.PodStatus, err error, timestamp time.Time) (updated bool) {
44 return true
45 }
46
47 func (c *fakeCache) Delete(id types.UID) {
48 }
49
50 func (c *fakeCache) UpdateTime(_ time.Time) {
51 }
52
View as plain text