Skip to content

Commit

Permalink
adding AssertExpectations
Browse files Browse the repository at this point in the history
  • Loading branch information
sanzmauro committed Nov 20, 2024
1 parent 4836d47 commit b8237b9
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion splitio/proxy/caching/workers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,14 +264,17 @@ func TestSynchronizeLargeSegment(t *testing.T) {
if *cn != 100 {
t.Error("ChangeNumber should be 100. Actual: ", *cn)
}

cacheFlusher.AssertExpectations(t)
largeSegmentStorage.AssertExpectations(t)
lsUpdater.AssertExpectations(t)
}

func TestSynchronizeLargeSegmentHighestPrevious(t *testing.T) {
lsName := "largeSegment1"

var splitStorage mocks.SplitStorageMock
var cacheFlusher mocks.CacheFlusherMock
cacheFlusher.On("EvictBySurrogate", MakeSurrogateForLargeSegmentChanges(lsName)).Times(0)

var largeSegmentStorage mocks.LargeSegmentStorageMock
largeSegmentStorage.On("ChangeNumber", lsName).Return(int64(200)).Once()
Expand All @@ -295,6 +298,11 @@ func TestSynchronizeLargeSegmentHighestPrevious(t *testing.T) {
if *cn != 100 {
t.Error("ChangeNumber should be 100. Actual: ", *cn)
}

splitStorage.AssertExpectations(t)
cacheFlusher.AssertExpectations(t)
largeSegmentStorage.AssertExpectations(t)
lsUpdater.AssertExpectations(t)
}

func TestSynchronizeLargeSegments(t *testing.T) {
Expand Down Expand Up @@ -337,4 +345,9 @@ func TestSynchronizeLargeSegments(t *testing.T) {
if *cn["ls2"] != cn2 {
t.Error("ChangeNumber should be 200. Actual: ", *cn["ls2"])
}

splitStorage.AssertExpectations(t)
cacheFlusher.AssertExpectations(t)
largeSegmentStorage.AssertExpectations(t)
lsUpdater.AssertExpectations(t)
}

0 comments on commit b8237b9

Please sign in to comment.