From 35c064b93739795832598893b1885ff7cfd9faf8 Mon Sep 17 00:00:00 2001 From: Marcello Stanisci Date: Wed, 3 Apr 2019 16:07:04 +0200 Subject: Faking the time. Cherry-pick tests now uses the now-faked version of taler-exchange-keyup. Fails. --- .../test_exchange_api_keys_cherry_picking_new.c | 40 +++++++++++++++------- 1 file changed, 28 insertions(+), 12 deletions(-) (limited to 'src/lib/test_exchange_api_keys_cherry_picking_new.c') diff --git a/src/lib/test_exchange_api_keys_cherry_picking_new.c b/src/lib/test_exchange_api_keys_cherry_picking_new.c index 4702b29d0..9760d91ba 100644 --- a/src/lib/test_exchange_api_keys_cherry_picking_new.c +++ b/src/lib/test_exchange_api_keys_cherry_picking_new.c @@ -35,6 +35,7 @@ #include "taler_fakebank_lib.h" #include "taler_testing_lib.h" + /** * Configuration file we use. One (big) configuration is used * for the various components for this test. @@ -53,6 +54,23 @@ #define CONFIG_FILE_EXTENDED_2 \ "test_exchange_api_keys_cherry_picking_extended_2.conf" +/** + * Current time. + */ +struct GNUNET_TIME_Absolute now; + +/** + * Adds to the current time. XXX, open question: shall we + * also _set_ the global current time after the faking? + * + * @param relative number of _seconds_ to add to the current time. + * @return a new absolute time, modified according to @e relative. + */ +#define NOWPLUSSECS(secs) \ + GNUNET_TIME_absolute_add \ + (now, \ + GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, \ + secs)) /** * Exchange base URL; mainly purpose is to make the compiler happy. */ @@ -140,20 +158,18 @@ run (void *cls, is->exchanged, SIGUSR1), /** - * 1 DK with 80s spend duration. + * 1 DK with 80s withdraw duration. Lookahead_sign is 60s. */ TALER_TESTING_cmd_check_keys ("check-keys-1", 1, /* generation */ 1), - - TALER_TESTING_cmd_sleep ("sleep", - 10), - /** - * We set lookahead_sign to 90s. + * We now set lookahead_sign to 90s, and fake 10s passed. */ - TALER_TESTING_cmd_exec_keyup ("keyup-2", - CONFIG_FILE_EXTENDED), + TALER_TESTING_cmd_exec_keyup_with_now ("keyup-2", + CONFIG_FILE_EXTENDED, + NOWPLUSSECS (10)), + TALER_TESTING_cmd_exec_auditor_sign ("sign-keys-1", CONFIG_FILE_EXTENDED), @@ -170,10 +186,10 @@ run (void *cls, 2, /* generation */ 2), - TALER_TESTING_cmd_sleep ("sleep", - 20), - TALER_TESTING_cmd_exec_keyup ("keyup-3", - CONFIG_FILE_EXTENDED), + /* Must fake 20s lapse now. */ + TALER_TESTING_cmd_exec_keyup_with_now ("keyup-3", + CONFIG_FILE_EXTENDED, + NOWPLUSSECS (20)), TALER_TESTING_cmd_exec_auditor_sign ("sign-keys-2", CONFIG_FILE), TALER_TESTING_cmd_signal ("trigger-keys-reload-2", -- cgit v1.2.3