@@ -23,7 +23,6 @@ import (
2323
2424 "github.com/golang/mock/gomock"
2525 . "github.com/onsi/gomega"
26-
2726 gomockinternal "sigs.k8s.io/cluster-api-provider-azure/internal/test/matchers/gomock"
2827 mockttllru "sigs.k8s.io/cluster-api-provider-azure/util/cache/ttllru/mocks"
2928)
@@ -42,7 +41,7 @@ func TestNew(t *testing.T) {
4241func TestCache_Add (t * testing.T ) {
4342 g := NewWithT (t )
4443 mockCtrl := gomock .NewController (t )
45- mockCache := mockttllru .NewMockcacher (mockCtrl )
44+ mockCache := mockttllru .NewMockCacher (mockCtrl )
4645 defer mockCtrl .Finish ()
4746 subject , err := newCache (defaultCacheDuration , mockCache )
4847 g .Expect (err ).Should (BeNil ())
@@ -78,11 +77,11 @@ func TestCache_Get(t *testing.T) {
7877
7978 cases := []struct {
8079 Name string
81- TestCase func (g * GomegaWithT , subject * Cache , mock * mockttllru.Mockcacher )
80+ TestCase func (g * GomegaWithT , subject PeekingCacher , mock * mockttllru.MockCacher )
8281 }{
8382 {
8483 Name : "NoItemsInCache" ,
85- TestCase : func (g * GomegaWithT , subject * Cache , mock * mockttllru.Mockcacher ) {
84+ TestCase : func (g * GomegaWithT , subject PeekingCacher , mock * mockttllru.MockCacher ) {
8685 key := "not_there"
8786 mock .EXPECT ().Get (key ).Return (nil , false )
8887 val , ok := subject .Get (key )
@@ -92,7 +91,7 @@ func TestCache_Get(t *testing.T) {
9291 },
9392 {
9493 Name : "ExistingItemNotExpired" ,
95- TestCase : func (g * GomegaWithT , subject * Cache , mock * mockttllru.Mockcacher ) {
94+ TestCase : func (g * GomegaWithT , subject PeekingCacher , mock * mockttllru.MockCacher ) {
9695 mock .EXPECT ().Get (key ).Return (& timeToLiveItem {
9796 LastTouch : time .Now (),
9897 Value : value ,
@@ -104,7 +103,7 @@ func TestCache_Get(t *testing.T) {
104103 },
105104 {
106105 Name : "ExistingItemExpired" ,
107- TestCase : func (g * GomegaWithT , subject * Cache , mock * mockttllru.Mockcacher ) {
106+ TestCase : func (g * GomegaWithT , subject PeekingCacher , mock * mockttllru.MockCacher ) {
108107 mock .EXPECT ().Get (key ).Return (& timeToLiveItem {
109108 LastTouch : time .Now ().Add (- (10 * time .Second + defaultCacheDuration )),
110109 Value : value ,
@@ -117,7 +116,7 @@ func TestCache_Get(t *testing.T) {
117116 },
118117 {
119118 Name : "ExistingItemGetAdvancesLastTouch" ,
120- TestCase : func (g * GomegaWithT , subject * Cache , mock * mockttllru.Mockcacher ) {
119+ TestCase : func (g * GomegaWithT , subject PeekingCacher , mock * mockttllru.MockCacher ) {
121120 lastTouch := time .Now ().Add (defaultCacheDuration - 10 * time .Second )
122121 item := & timeToLiveItem {
123122 LastTouch : lastTouch ,
@@ -133,7 +132,7 @@ func TestCache_Get(t *testing.T) {
133132 },
134133 {
135134 Name : "ExistingItemIsNotTTLItem" ,
136- TestCase : func (g * GomegaWithT , subject * Cache , mock * mockttllru.Mockcacher ) {
135+ TestCase : func (g * GomegaWithT , subject PeekingCacher , mock * mockttllru.MockCacher ) {
137136 item := & struct {
138137 Value string
139138 }{
@@ -153,7 +152,7 @@ func TestCache_Get(t *testing.T) {
153152 t .Run (c .Name , func (t * testing.T ) {
154153 g := NewWithT (t )
155154 mockCtrl := gomock .NewController (t )
156- mockCache := mockttllru .NewMockcacher (mockCtrl )
155+ mockCache := mockttllru .NewMockCacher (mockCtrl )
157156 defer mockCtrl .Finish ()
158157 subject , err := newCache (defaultCacheDuration , mockCache )
159158 g .Expect (err ).Should (BeNil ())
0 commit comments