Skip to content

Commit dd1e885

Browse files
committed
fix test
1 parent 5154655 commit dd1e885

File tree

1 file changed

+24
-15
lines changed

1 file changed

+24
-15
lines changed

iroh/tests/spaces.rs

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ async fn spaces_subscription() -> Result<()> {
164164

165165
let (betty_space, betty_sync_intent) = betty
166166
.spaces()
167-
.import_and_sync(ticket, SessionMode::ReconcileOnce)
167+
.import_and_sync(ticket, SessionMode::Continuous)
168168
.await?;
169169

170170
let _sync_task = tokio::task::spawn(async move {
@@ -177,37 +177,46 @@ async fn spaces_subscription() -> Result<()> {
177177
.resume_subscription(0, Area::new_full(), Default::default())
178178
.await?;
179179

180-
alfie_space
181-
.insert_bytes(
182-
EntryForm::new(alfie_user, Path::from_bytes(&[b"foo"])?),
183-
"hi",
184-
)
185-
.await?;
186-
187180
betty_space
188181
.insert_bytes(
189182
EntryForm::new(betty_user, Path::from_bytes(&[b"foo"])?),
190183
"hi",
191184
)
192185
.await?;
193186

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+
194198
alfie_space
195199
.insert_bytes(
196-
EntryForm::new(alfie_user, Path::from_bytes(&[b"foo"])?),
200+
EntryForm::new(alfie_user, Path::from_bytes(&[b"bar"])?),
197201
"hi!!",
198202
)
199203
.await?;
200204

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)));
204208

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:?}");
207211
assert!(matches!(
208212
ev,
209-
StoreEvent::Ingested(0, _, EntryOrigin::Remote(_))
213+
StoreEvent::Ingested(1, _, EntryOrigin::Remote(_))
210214
));
211215

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+
212221
Ok(())
213222
}

0 commit comments

Comments
 (0)