@@ -119,21 +119,21 @@ func TestMemoryEventStoreState(t *testing.T) {
119119 {
120120 "appends" ,
121121 func (s * MemoryEventStore ) {
122- appendEvent (s , "S1" , 1 , "d1" )
123- appendEvent (s , "S1" , 2 , "d2" )
124- appendEvent (s , "S1" , 1 , "d3" )
125- appendEvent (s , "S2" , 8 , "d4" )
122+ appendEvent (s , "S1" , "1" , "d1" )
123+ appendEvent (s , "S1" , "2" , "d2" )
124+ appendEvent (s , "S1" , "1" , "d3" )
125+ appendEvent (s , "S2" , "8" , "d4" )
126126 },
127127 "S1 1 first=0 d1 d3; S1 2 first=0 d2; S2 8 first=0 d4" ,
128128 8 ,
129129 },
130130 {
131131 "session close" ,
132132 func (s * MemoryEventStore ) {
133- appendEvent (s , "S1" , 1 , "d1" )
134- appendEvent (s , "S1" , 2 , "d2" )
135- appendEvent (s , "S1" , 1 , "d3" )
136- appendEvent (s , "S2" , 8 , "d4" )
133+ appendEvent (s , "S1" , "1" , "d1" )
134+ appendEvent (s , "S1" , "2" , "d2" )
135+ appendEvent (s , "S1" , "1" , "d3" )
136+ appendEvent (s , "S2" , "8" , "d4" )
137137 s .SessionClosed (ctx , "S1" )
138138 },
139139 "S2 8 first=0 d4" ,
@@ -142,10 +142,10 @@ func TestMemoryEventStoreState(t *testing.T) {
142142 {
143143 "purge" ,
144144 func (s * MemoryEventStore ) {
145- appendEvent (s , "S1" , 1 , "d1" )
146- appendEvent (s , "S1" , 2 , "d2" )
147- appendEvent (s , "S1" , 1 , "d3" )
148- appendEvent (s , "S2" , 8 , "d4" )
145+ appendEvent (s , "S1" , "1" , "d1" )
146+ appendEvent (s , "S1" , "2" , "d2" )
147+ appendEvent (s , "S1" , "1" , "d3" )
148+ appendEvent (s , "S2" , "8" , "d4" )
149149 // We are using 8 bytes (d1,d2, d3, d4).
150150 // To purge 6, we remove the first of each stream, leaving only d3.
151151 s .SetMaxBytes (2 )
@@ -157,31 +157,31 @@ func TestMemoryEventStoreState(t *testing.T) {
157157 {
158158 "purge append" ,
159159 func (s * MemoryEventStore ) {
160- appendEvent (s , "S1" , 1 , "d1" )
161- appendEvent (s , "S1" , 2 , "d2" )
162- appendEvent (s , "S1" , 1 , "d3" )
163- appendEvent (s , "S2" , 8 , "d4" )
160+ appendEvent (s , "S1" , "1" , "d1" )
161+ appendEvent (s , "S1" , "2" , "d2" )
162+ appendEvent (s , "S1" , "1" , "d3" )
163+ appendEvent (s , "S2" , "8" , "d4" )
164164 s .SetMaxBytes (2 )
165165 // Up to here, identical to the "purge" case.
166166 // Each of these additions will result in a purge.
167- appendEvent (s , "S1" , 2 , "d5" ) // remove d3
168- appendEvent (s , "S1" , 2 , "d6" ) // remove d5
167+ appendEvent (s , "S1" , "2" , "d5" ) // remove d3
168+ appendEvent (s , "S1" , "2" , "d6" ) // remove d5
169169 },
170170 "S1 1 first=2; S1 2 first=2 d6; S2 8 first=1" ,
171171 2 ,
172172 },
173173 {
174174 "purge resize append" ,
175175 func (s * MemoryEventStore ) {
176- appendEvent (s , "S1" , 1 , "d1" )
177- appendEvent (s , "S1" , 2 , "d2" )
178- appendEvent (s , "S1" , 1 , "d3" )
179- appendEvent (s , "S2" , 8 , "d4" )
176+ appendEvent (s , "S1" , "1" , "d1" )
177+ appendEvent (s , "S1" , "2" , "d2" )
178+ appendEvent (s , "S1" , "1" , "d3" )
179+ appendEvent (s , "S2" , "8" , "d4" )
180180 s .SetMaxBytes (2 )
181181 // Up to here, identical to the "purge" case.
182182 s .SetMaxBytes (6 ) // make room
183- appendEvent (s , "S1" , 2 , "d5" )
184- appendEvent (s , "S1" , 2 , "d6" )
183+ appendEvent (s , "S1" , "2" , "d5" )
184+ appendEvent (s , "S1" , "2" , "d6" )
185185 },
186186 // The other streams remain, because we may add to them.
187187 "S1 1 first=1 d3; S1 2 first=1 d5 d6; S2 8 first=1" ,
@@ -206,10 +206,10 @@ func TestMemoryEventStoreAfter(t *testing.T) {
206206 ctx := context .Background ()
207207 s := NewMemoryEventStore (nil )
208208 s .SetMaxBytes (4 )
209- s .Append (ctx , "S1" , 1 , []byte ("d1" ))
210- s .Append (ctx , "S1" , 1 , []byte ("d2" ))
211- s .Append (ctx , "S1" , 1 , []byte ("d3" ))
212- s .Append (ctx , "S1" , 2 , []byte ("d4" )) // will purge d1
209+ s .Append (ctx , "S1" , "1" , []byte ("d1" ))
210+ s .Append (ctx , "S1" , "1" , []byte ("d2" ))
211+ s .Append (ctx , "S1" , "1" , []byte ("d3" ))
212+ s .Append (ctx , "S1" , "2" , []byte ("d4" )) // will purge d1
213213 want := "S1 1 first=1 d2 d3; S1 2 first=0 d4"
214214 if got := s .debugString (); got != want {
215215 t .Fatalf ("got state %q, want %q" , got , want )
@@ -222,14 +222,14 @@ func TestMemoryEventStoreAfter(t *testing.T) {
222222 want []string
223223 wantErr string // if non-empty, error should contain this string
224224 }{
225- {"S1" , 1 , 0 , []string {"d2" , "d3" }, "" },
226- {"S1" , 1 , 1 , []string {"d3" }, "" },
227- {"S1" , 1 , 2 , nil , "" },
228- {"S1" , 2 , 0 , nil , "" },
229- {"S1" , 3 , 0 , nil , "unknown stream ID" },
230- {"S2" , 0 , 0 , nil , "unknown session ID" },
225+ {"S1" , "1" , 0 , []string {"d2" , "d3" }, "" },
226+ {"S1" , "1" , 1 , []string {"d3" }, "" },
227+ {"S1" , "1" , 2 , nil , "" },
228+ {"S1" , "2" , 0 , nil , "" },
229+ {"S1" , "3" , 0 , nil , "unknown stream ID" },
230+ {"S2" , "0" , 0 , nil , "unknown session ID" },
231231 } {
232- t .Run (fmt .Sprintf ("%s-%d -%d" , tt .sessionID , tt .streamID , tt .index ), func (t * testing.T ) {
232+ t .Run (fmt .Sprintf ("%s-%s -%d" , tt .sessionID , tt .streamID , tt .index ), func (t * testing.T ) {
233233 var got []string
234234 for d , err := range s .After (ctx , tt .sessionID , tt .streamID , tt .index ) {
235235 if err != nil {
0 commit comments