Skip to content

Commit 25a5151

Browse files
committed
Simpler assertions on keys test
1 parent 38fd8a4 commit 25a5151

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

tests/integration.rs

+11-6
Original file line numberDiff line numberDiff line change
@@ -350,16 +350,21 @@ async fn test_getrange() {
350350
#[serial]
351351
async fn test_keys() {
352352
test_compare::<Vec<Value>>(|p| {
353-
// Redis keys order is deterministice but not guaranteed.
354-
// We sort the keys by insertion order to make the test deterministic.
355-
// Testing with a different set of keys produces different results,
356-
// but matching the implementation is out of the scope of the project.
353+
// Redis keys order is deterministic (always returning the same order for
354+
// a given set of keys) but not guaranteed (it may change between runs).
355+
//
356+
// We sort in backward chronological order to get deterministic results.
357+
// Matching the implementation is out of the scope of the project.
357358
p.cmd("SET").arg("keys_key_1").arg("Argentina");
358-
p.cmd("SET").arg("keys_key_2").arg("Spain");
359-
p.cmd("SET").arg("keys_key_3").arg("Netherlands");
360359

361360
p.cmd("KEYS").arg("*");
362361
p.cmd("KEYS").arg("*key*");
362+
363+
p.cmd("SET").arg("keys_key_2").arg("Spain");
364+
p.cmd("SET").arg("keys_key_3").arg("Netherlands");
365+
366+
p.cmd("KEYS").arg("*1");
367+
p.cmd("KEYS").arg("*2");
363368
p.cmd("KEYS").arg("*3");
364369
})
365370
.await;

0 commit comments

Comments
 (0)