Skip to content

Commit 95c8c06

Browse files
authored
Smoketest subscribe properly respects new confirmed behavior (#4454)
# Description of Changes This doesn't actually change any used behavior, but fixes the (apparently unused) `subscribe_confirmed` function, and makes it possible to request unconfirmed reads as well. # API and ABI breaking changes None # Expected complexity level and risk 1 # Testing CI still passes? 🤷 --------- Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
1 parent a327f91 commit 95c8c06

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

crates/smoketests/src/lib.rs

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1317,40 +1317,41 @@ log = "0.4"
13171317
/// Returns the updates as JSON values.
13181318
/// For tests that need to perform actions while subscribed, use `subscribe_background` instead.
13191319
pub fn subscribe(&self, queries: &[&str], n: usize) -> Result<Vec<serde_json::Value>> {
1320-
self.subscribe_opts(queries, n, false)
1320+
self.subscribe_opts(queries, n, None)
13211321
}
13221322

13231323
/// Starts a subscription with --confirmed flag and waits for N updates.
13241324
pub fn subscribe_confirmed(&self, queries: &[&str], n: usize) -> Result<Vec<serde_json::Value>> {
1325-
self.subscribe_opts(queries, n, true)
1325+
self.subscribe_opts(queries, n, Some(true))
13261326
}
13271327

13281328
/// Internal helper for subscribe with options.
1329-
fn subscribe_opts(&self, queries: &[&str], n: usize, confirmed: bool) -> Result<Vec<serde_json::Value>> {
1329+
fn subscribe_opts(&self, queries: &[&str], n: usize, confirmed: Option<bool>) -> Result<Vec<serde_json::Value>> {
13301330
let start = Instant::now();
13311331
let identity = self.database_identity.as_ref().context("No database published")?;
13321332
let config_path_str = self.config_path.to_str().unwrap();
13331333

13341334
let cli_path = ensure_binaries_built();
13351335
let mut cmd = Command::new(&cli_path);
13361336
let mut args = vec![
1337-
"--config-path",
1338-
config_path_str,
1339-
"subscribe",
1340-
"--server",
1341-
&self.server_url,
1342-
identity,
1343-
"-t",
1344-
"30",
1345-
"-n",
1337+
"--config-path".to_string(),
1338+
config_path_str.to_string(),
1339+
"subscribe".to_string(),
1340+
"--server".to_string(),
1341+
self.server_url.to_string(),
1342+
identity.to_string(),
1343+
"-t".to_string(),
1344+
"30".to_string(),
1345+
"-n".to_string(),
13461346
];
13471347
let n_str = n.to_string();
1348-
args.push(&n_str);
1349-
args.push("--print-initial-update");
1350-
if confirmed {
1351-
args.push("--confirmed");
1348+
args.push(n_str);
1349+
args.push("--print-initial-update".to_string());
1350+
if let Some(confirmed) = confirmed {
1351+
args.push("--confirmed".to_string());
1352+
args.push(confirmed.to_string());
13521353
}
1353-
args.push("--");
1354+
args.push("--".to_string());
13541355
cmd.args(&args)
13551356
.args(queries)
13561357
.stdout(Stdio::piped())

0 commit comments

Comments
 (0)