Skip to content

Commit

Permalink
Simpler assertions on keys test
Browse files Browse the repository at this point in the history
  • Loading branch information
gillchristian committed Oct 20, 2024
1 parent 38fd8a4 commit 25a5151
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,16 +350,21 @@ async fn test_getrange() {
#[serial]
async fn test_keys() {
test_compare::<Vec<Value>>(|p| {
// Redis keys order is deterministice but not guaranteed.
// We sort the keys by insertion order to make the test deterministic.
// Testing with a different set of keys produces different results,
// but matching the implementation is out of the scope of the project.
// Redis keys order is deterministic (always returning the same order for
// a given set of keys) but not guaranteed (it may change between runs).
//
// We sort in backward chronological order to get deterministic results.
// Matching the implementation is out of the scope of the project.
p.cmd("SET").arg("keys_key_1").arg("Argentina");
p.cmd("SET").arg("keys_key_2").arg("Spain");
p.cmd("SET").arg("keys_key_3").arg("Netherlands");

p.cmd("KEYS").arg("*");
p.cmd("KEYS").arg("*key*");

p.cmd("SET").arg("keys_key_2").arg("Spain");
p.cmd("SET").arg("keys_key_3").arg("Netherlands");

p.cmd("KEYS").arg("*1");
p.cmd("KEYS").arg("*2");
p.cmd("KEYS").arg("*3");
})
.await;
Expand Down

0 comments on commit 25a5151

Please sign in to comment.