@@ -164,7 +164,7 @@ async fn spaces_subscription() -> Result<()> {
164
164
165
165
let ( betty_space, betty_sync_intent) = betty
166
166
. spaces ( )
167
- . import_and_sync ( ticket, SessionMode :: ReconcileOnce )
167
+ . import_and_sync ( ticket, SessionMode :: Continuous )
168
168
. await ?;
169
169
170
170
let _sync_task = tokio:: task:: spawn ( async move {
@@ -177,37 +177,46 @@ async fn spaces_subscription() -> Result<()> {
177
177
. resume_subscription ( 0 , Area :: new_full ( ) , Default :: default ( ) )
178
178
. await ?;
179
179
180
- alfie_space
181
- . insert_bytes (
182
- EntryForm :: new ( alfie_user, Path :: from_bytes ( & [ b"foo" ] ) ?) ,
183
- "hi" ,
184
- )
185
- . await ?;
186
-
187
180
betty_space
188
181
. insert_bytes (
189
182
EntryForm :: new ( betty_user, Path :: from_bytes ( & [ b"foo" ] ) ?) ,
190
183
"hi" ,
191
184
)
192
185
. await ?;
193
186
187
+ let ev = betty_sub. next ( ) . await . unwrap ( ) . unwrap ( ) ;
188
+ println ! ( "BETTY 1 {ev:?}" ) ;
189
+ assert ! ( matches!( ev, StoreEvent :: Ingested ( 0 , _, EntryOrigin :: Local ) ) ) ;
190
+
191
+ let ev = alfie_sub. next ( ) . await . unwrap ( ) . unwrap ( ) ;
192
+ println ! ( "ALFIE 1 {ev:?}" ) ;
193
+ assert ! ( matches!(
194
+ ev,
195
+ StoreEvent :: Ingested ( 0 , _, EntryOrigin :: Remote ( _) )
196
+ ) ) ;
197
+
194
198
alfie_space
195
199
. insert_bytes (
196
- EntryForm :: new ( alfie_user, Path :: from_bytes ( & [ b"foo " ] ) ?) ,
200
+ EntryForm :: new ( alfie_user, Path :: from_bytes ( & [ b"bar " ] ) ?) ,
197
201
"hi!!" ,
198
202
)
199
203
. await ?;
200
204
201
- let ev = alfie_sub. next ( ) . await . unwrap ( ) ;
202
- println ! ( "ALFIE 2" ) ;
203
- assert ! ( matches!( ev, StoreEvent :: Ingested ( 0 , _, EntryOrigin :: Local ) ) ) ;
205
+ let ev = alfie_sub. next ( ) . await . unwrap ( ) . unwrap ( ) ;
206
+ println ! ( "ALFIE 2 {ev:?} " ) ;
207
+ assert ! ( matches!( ev, StoreEvent :: Ingested ( 1 , _, EntryOrigin :: Local ) ) ) ;
204
208
205
- let ev = betty_sub. next ( ) . await . unwrap ( ) ;
206
- println ! ( "BETTY 2" ) ;
209
+ let ev = betty_sub. next ( ) . await . unwrap ( ) . unwrap ( ) ;
210
+ println ! ( "BETTY 2 {ev:?} " ) ;
207
211
assert ! ( matches!(
208
212
ev,
209
- StoreEvent :: Ingested ( 0 , _, EntryOrigin :: Remote ( _) )
213
+ StoreEvent :: Ingested ( 1 , _, EntryOrigin :: Remote ( _) )
210
214
) ) ;
211
215
216
+ // let resume_sub = alfie_space
217
+ // .resume_subscription(0, Area::new_full(), Default::default())
218
+ // .await?;
219
+ // assert_eq!(resume_sub.count().await, 2);
220
+
212
221
Ok ( ( ) )
213
222
}
0 commit comments