Skip to content

Commit b57352c

Browse files
committed
Use PX and HTTL to test
Signed-off-by: Hanxi Zhang <hanxizh@amazon.com>
1 parent 49f9e99 commit b57352c

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

tests/unit/hashexpire.tcl

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4587,15 +4587,19 @@ start_server {tags {"hashexpire skip expired fields"}} {
45874587

45884588
# Disable active expiration
45894589
r DEBUG SET-ACTIVE-EXPIRE 0
4590-
4591-
# HSETEX many fields with small ttl (EX 1)
4592-
r HSETEX myhash EX 1 FIELDS 3 f1 v1 f2 v2 f3 v3
4590+
r HSETEX myhash PX 1 FIELDS 3 f1 v1 f2 v2 f3 v3
45934591

45944592
# Add a permanent field to verify selective skipping
45954593
r HSET myhash permanent permanent_value
45964594

4597-
# Wait for TTL to expire
4598-
after 2000
4595+
# Wait until all fields are expired (HTTL returns -2)
4596+
wait_for_condition 50 100 {
4597+
[lindex [r HTTL myhash FIELDS 1 f1] 0] == -2 &&
4598+
[lindex [r HTTL myhash FIELDS 1 f2] 0] == -2 &&
4599+
[lindex [r HTTL myhash FIELDS 1 f3] 0] == -2
4600+
} else {
4601+
fail "Fields did not expire"
4602+
}
45994603

46004604
r SAVE
46014605
r FLUSHALL
@@ -4611,4 +4615,4 @@ start_server {tags {"hashexpire skip expired fields"}} {
46114615
assert_equal "" [r HGET myhash f2]
46124616
assert_equal "" [r HGET myhash f3]
46134617
} {} {needs:debug}
4614-
}
4618+
}

0 commit comments

Comments
 (0)