feat(go): persist realtime snapshots to mysql
This commit is contained in:
@@ -42,6 +42,20 @@ func TestProcessRealtimeMessageUsesUncancelledContextForUpdateAndCommit(t *testi
|
||||
}
|
||||
}
|
||||
|
||||
func TestCompositeRealtimeUpdaterUpdatesBothStores(t *testing.T) {
|
||||
env := envelope.FrameEnvelope{Protocol: envelope.ProtocolGB32960, VIN: "VIN001"}
|
||||
redisUpdater := &contextCheckingRealtimeUpdater{}
|
||||
snapshotUpdater := &contextCheckingRealtimeUpdater{}
|
||||
updater := compositeRealtimeUpdater{primary: redisUpdater, secondary: snapshotUpdater}
|
||||
|
||||
if err := updater.Update(context.Background(), env); err != nil {
|
||||
t.Fatalf("Update() error = %v", err)
|
||||
}
|
||||
if redisUpdater.count != 1 || snapshotUpdater.count != 1 {
|
||||
t.Fatalf("updates primary=%d secondary=%d", redisUpdater.count, snapshotUpdater.count)
|
||||
}
|
||||
}
|
||||
|
||||
type contextCheckingRealtimeUpdater struct {
|
||||
ctxErr error
|
||||
count int
|
||||
|
||||
Reference in New Issue
Block a user