Skip to content

Commit

Permalink
fix: make the linter happy, fix a lifecycle unit test
Browse files Browse the repository at this point in the history
Signed-off-by: Elias Van Ootegem <[email protected]>
  • Loading branch information
EVODelavega committed Sep 23, 2024
1 parent fbbe990 commit a5b81a8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
17 changes: 6 additions & 11 deletions core/volumerebate/engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,21 +119,16 @@ func TestVolumeRebateProgramLifecycle(t *testing.T) {
assertSnapshotMatches(t, key, hashWithNewAndCurrent)

// // expect a program updated event
broker.EXPECT().Send(gomock.Any()).DoAndReturn(func(evt events.Event) {
e, ok := evt.(*events.VolumeRebateProgramUpdated)
if !ok {
return
}
broker.EXPECT().Send(updatedEvt).DoAndReturn(func(evt events.Event) {
e := evt.(*events.VolumeRebateProgramUpdated)
require.Equal(t, p2.IntoProto(), e.GetVolumeRebateProgramUpdated().Program)
}).Times(2)
}).Times(1)
broker.EXPECT().Send(statsEvt).Times(1)
engine.OnEpoch(context.Background(), types.Epoch{Action: vega.EpochAction_EPOCH_ACTION_START, StartTime: now.Add(time.Hour * 1)})

// // expire the program
broker.EXPECT().Send(gomock.Any()).DoAndReturn(func(evt events.Event) {
e, ok := evt.(*events.VolumeRebateProgramEnded)
if !ok {
return
}
broker.EXPECT().Send(endedEvt).DoAndReturn(func(evt events.Event) {
e := evt.(*events.VolumeRebateProgramEnded)
require.Equal(t, p2.Version, e.GetVolumeRebateProgramEnded().Version)
}).Times(1)
engine.OnEpoch(context.Background(), types.Epoch{Action: vega.EpochAction_EPOCH_ACTION_START, StartTime: now.Add(time.Hour * 2)})
Expand Down
2 changes: 1 addition & 1 deletion core/volumerebate/helpers_for_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ import (
var (
endedEvt = evtMatcher[events.VolumeRebateProgramEnded]{}
startedEvt = evtMatcher[events.VolumeRebateProgramStarted]{}
updatedEvt = evtMatcher[events.VolumeRebateProgramUpdated]{}
statsEvt = evtMatcher[events.VolumeRebateStatsUpdated]{}
updatedEvt = evtMatcher[events.VolumeRebateProgramUpdated]{}
)

type evts interface {
Expand Down

0 comments on commit a5b81a8

Please sign in to comment.