diff options
author | Marcello Stanisci <stanisci.m@gmail.com> | 2019-04-03 16:07:04 +0200 |
---|---|---|
committer | Marcello Stanisci <stanisci.m@gmail.com> | 2019-04-03 16:07:04 +0200 |
commit | 35c064b93739795832598893b1885ff7cfd9faf8 (patch) | |
tree | 36dc79df5790f97ec56604f395e01e8ea5c73311 /src/lib/test_exchange_api_keys_cherry_picking_new.c | |
parent | 219f702926c61adedea9458e07a6936e76cfe13e (diff) | |
download | exchange-35c064b93739795832598893b1885ff7cfd9faf8.tar.gz exchange-35c064b93739795832598893b1885ff7cfd9faf8.tar.bz2 exchange-35c064b93739795832598893b1885ff7cfd9faf8.zip |
Faking the time.
Cherry-pick tests now uses the now-faked version
of taler-exchange-keyup. Fails.
Diffstat (limited to 'src/lib/test_exchange_api_keys_cherry_picking_new.c')
-rw-r--r-- | src/lib/test_exchange_api_keys_cherry_picking_new.c | 40 |
1 files changed, 28 insertions, 12 deletions
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. @@ -54,6 +55,23 @@ "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. */ static char *exchange_url; @@ -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", |