Skip to content

Commit dbfa623

Browse files
fix tests
1 parent 2d910bd commit dbfa623

2 files changed

Lines changed: 6 additions & 9 deletions

File tree

crates/smoketests/tests/smoketests/auto_migration.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -343,11 +343,9 @@ fn test_add_table_columns() {
343343
// Subscribe to person table changes multiple times to simulate active clients
344344
let mut subs = Vec::with_capacity(NUM_SUBSCRIBERS);
345345
for _ in 0..NUM_SUBSCRIBERS {
346-
// We need unconfirmed reads for the updates to arrive properly.
347-
// Otherwise, there's a race between module teardown in publish, vs subscribers
348-
// getting the row deletion they expect.
346+
// The migration below should disconnect all existing subscribers.
349347
subs.push(
350-
test.subscribe_background_unconfirmed(&["select * from person"], 5)
348+
test.subscribe_background_until_closed(&["select * from person"])
351349
.unwrap(),
352350
);
353351
}
@@ -389,9 +387,8 @@ fn test_add_table_columns() {
389387
test.call("add_person", &["Robert2"]).unwrap();
390388

391389
// Validate all subscribers were disconnected after first upgrade
392-
for (i, sub) in subs.into_iter().enumerate() {
393-
let rows = sub.collect().unwrap();
394-
assert_eq!(rows.len(), 2, "Subscriber {i} received unexpected rows: {rows:?}");
390+
for sub in subs {
391+
sub.collect().unwrap();
395392
}
396393

397394
// Second upgrade

crates/smoketests/tests/smoketests/views.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ fn test_view_primary_key_auto_migration_disconnects_clients() {
592592
.build();
593593

594594
let sub = test
595-
.subscribe_background_unconfirmed(&["select * from player"], 2)
595+
.subscribe_background_until_closed(&["select * from player"])
596596
.unwrap();
597597

598598
test.use_precompiled_module("views-primary-key-auto-migrate-updated");
@@ -672,7 +672,7 @@ fn test_subscribing_with_different_identities() {
672672

673673
test.new_identity().unwrap();
674674

675-
let sub = test.subscribe_background(&["select * from my_player"], 2).unwrap();
675+
let sub = test.subscribe_background(&["select * from my_player"], 1).unwrap();
676676
test.call("insert_player", &["Bob"]).unwrap();
677677
let events = sub.collect().unwrap();
678678

0 commit comments

Comments
 (0)