Skip to content

Commit

Permalink
clustertest: Add partial query to adapters_lt_replicas test
Browse files Browse the repository at this point in the history
Add a partial query, including writes, to the clustertest covering
running fewer adapters than the number of configured reader replicas.

Change-Id: I7d41ef928b1be23f3bdeed28056654b5e1ba0178
Reviewed-on: https://gerrit.readyset.name/c/readyset/+/5550
Tested-by: Buildkite CI
Reviewed-by: Luke Osborne <luke@readyset.io>
  • Loading branch information
glittershark committed Jul 26, 2023
1 parent a8f4625 commit ca7ef7d
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions readyset-clustertest/src/readyset_postgres.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,13 @@ async fn embedded_readers_adapters_lt_replicas() {
.is_ok()
}

eventually! {
adapter
.query_drop("CREATE CACHE FROM SELECT count(*) FROM t WHERE x = $1;")
.await
.is_ok()
}

eventually! {
run_test: {
let res: Vec<Vec<DfValue>> = adapter
Expand All @@ -156,6 +163,23 @@ async fn embedded_readers_adapters_lt_replicas() {
}
}

eventually! {
run_test: {
let res: Vec<Vec<DfValue>> = adapter
.execute(&"SELECT count(*) FROM t WHERE x = $1;", [DfValue::from(1i32)])
.await
.unwrap()
.try_into()
.unwrap();
let dest = last_statement_destination(&mut adapter).await;
(res, dest)
},
then_assert: |(res, dest)| {
assert_eq!(dest, QueryDestination::Readyset);
assert_eq!(res, vec![vec![1.into()]]);
}
}

adapter
.query_drop("INSERT INTO t (x) VALUES (2);")
.await
Expand All @@ -178,5 +202,28 @@ async fn embedded_readers_adapters_lt_replicas() {
assert_eq!(res, vec![vec![1.into()], vec![2.into()]]);
}
}

adapter
.query_drop("INSERT INTO t (x) VALUES (1);")
.await
.unwrap();

eventually! {
run_test: {
let res: Vec<Vec<DfValue>> = adapter
.execute(&"SELECT count(*) FROM t WHERE x = $1;", [DfValue::from(1i32)])
.await
.unwrap()
.try_into()
.unwrap();
let dest = last_statement_destination(&mut adapter).await;
(res, dest)
},
then_assert: |(res, dest)| {
assert_eq!(dest, QueryDestination::Readyset);
assert_eq!(res, vec![vec![2.into()]]);
}
}

deployment.teardown().await.unwrap();
}

0 comments on commit ca7ef7d

Please sign in to comment.