Skip to content

Commit

Permalink
Merge pull request #38 from alexist/fix/tu-testUnexpire-ttl
Browse files Browse the repository at this point in the history
fix(tu): fix unit test TouchTestCase.testUnexpire TTL
  • Loading branch information
grrolland authored Jan 19, 2024
2 parents 3db9ffe + 700b387 commit 3f0ef2f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/test/java/io/github/grrolland/hcshm/TouchTestCase.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,25 @@ public void testTouchFound() {
public void testUnexpire() {

try {
getWriter().write("SET key 1 10\r\n");
// Ensure key is not found (debug test)
getWriter().write("GET key\r\n");
getWriter().flush();
assertResponseNotFound();
// Set key that expire in 3 s
getWriter().write("SET key 3 10\r\n");
getWriter().write("1234567890");
getWriter().flush();
assertResponseGetValue("1234567890");

// Clear key expiration
getWriter().write("TOUCH key 0\r\n");
getWriter().flush();
assertResponseDone();

pause();
// Wait more than 3 seconds
pause(4000);

// Key should be there
getWriter().write("GET key\r\n");
getWriter().flush();
assertResponseGetValue("1234567890");
Expand Down

0 comments on commit 3f0ef2f

Please sign in to comment.