Skip to content

Commit

Permalink
test: schedule test logins on correct day
Browse files Browse the repository at this point in the history
As the current time is moving on throught the test, the calculation of "n days
ago" ends up picking a time which is slightly more than "n days ago", so reduce
n by one. This error was mostly neutralised by the rotation threshold throwing
away microseconds, but with that fixed, the tests always fail unless this is
also fixed.
  • Loading branch information
andy-bower authored and thkukuk committed Feb 10, 2025
1 parent b585c09 commit 96c775e
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions tests/tst-login-logout.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,26 +184,26 @@ main(void)
/* make sure there is no old stuff flying around. The backup file is not so important. */
remove (db_path);

if (test_args (db_path, "user1", "test-tty", "localhost", NULL, 4) != 0)
if (test_args (db_path, "user1", "test-tty", "localhost", NULL, 3) != 0)
return 1;
if (test_args (db_path, "user2", NULL, NULL, NULL, 4) != 0)
if (test_args (db_path, "user2", NULL, NULL, NULL, 3) != 0)
return 1;
if (test_args (db_path, "user3", NULL, NULL, NULL, 4) != 0)
if (test_args (db_path, "user3", NULL, NULL, NULL, 3) != 0)
return 1;
if (test_args (db_path, "user4", "test-tty", NULL, NULL, 4) != 0)
if (test_args (db_path, "user4", "test-tty", NULL, NULL, 3) != 0)
return 1;
if (test_args (db_path, "user5", NULL, "localhost", NULL, 4) != 0)
if (test_args (db_path, "user5", NULL, "localhost", NULL, 3) != 0)
return 1;

if (test_args (db_path, "user1", "test-tty", "localhost", NULL, 3) != 0)
if (test_args (db_path, "user1", "test-tty", "localhost", NULL, 2) != 0)
return 1;
if (test_args (db_path, "user2", NULL, NULL, NULL, 3) != 0)
if (test_args (db_path, "user2", NULL, NULL, NULL, 2) != 0)
return 1;
if (test_args (db_path, "user3", NULL, NULL, NULL, 3) != 0)
if (test_args (db_path, "user3", NULL, NULL, NULL, 2) != 0)
return 1;
if (test_args (db_path, "user4", "test-tty", NULL, NULL, 3) != 0)
if (test_args (db_path, "user4", "test-tty", NULL, NULL, 2) != 0)
return 1;
if (test_args (db_path, "user5", NULL, "localhost", NULL, 3) != 0)
if (test_args (db_path, "user5", NULL, "localhost", NULL, 2) != 0)
return 1;

if (test_rotate (db_path, 3) != 0)
Expand Down

0 comments on commit 96c775e

Please sign in to comment.