Artificial 'now'.
Getting to the point where "/keys" discards expired DKs due to the artificial 'now' given on the URL.
This commit is contained in:
parent
8655a40ad7
commit
fdeb630160
@ -730,7 +730,8 @@ reload_keys_denom_iter (void *cls,
|
||||
return GNUNET_OK;
|
||||
}
|
||||
|
||||
horizon = GNUNET_TIME_relative_to_absolute (TALER_EXCHANGE_conf_duration_provide ());
|
||||
horizon = GNUNET_TIME_absolute_add (rfc->now,
|
||||
TALER_EXCHANGE_conf_duration_provide ());
|
||||
start = GNUNET_TIME_absolute_ntoh (dki->issue.properties.start);
|
||||
if (start.abs_value_us > horizon.abs_value_us)
|
||||
{
|
||||
|
@ -101,6 +101,15 @@ WIRE-FEE-2023 = EUR:0.01
|
||||
WIRE-FEE-2024 = EUR:0.01
|
||||
WIRE-FEE-2025 = EUR:0.01
|
||||
WIRE-FEE-2026 = EUR:0.01
|
||||
WIRE-FEE-2027 = EUR:0.01
|
||||
WIRE-FEE-2028 = EUR:0.01
|
||||
WIRE-FEE-2029 = EUR:0.01
|
||||
WIRE-FEE-2030 = EUR:0.01
|
||||
WIRE-FEE-2031 = EUR:0.01
|
||||
WIRE-FEE-2032 = EUR:0.01
|
||||
WIRE-FEE-2033 = EUR:0.01
|
||||
WIRE-FEE-2034 = EUR:0.01
|
||||
WIRE-FEE-2035 = EUR:0.01
|
||||
|
||||
CLOSING-FEE-2017 = EUR:0.01
|
||||
CLOSING-FEE-2018 = EUR:0.01
|
||||
@ -112,6 +121,16 @@ CLOSING-FEE-2023 = EUR:0.01
|
||||
CLOSING-FEE-2024 = EUR:0.01
|
||||
CLOSING-FEE-2025 = EUR:0.01
|
||||
CLOSING-FEE-2026 = EUR:0.01
|
||||
CLOSING-FEE-2027 = EUR:0.01
|
||||
CLOSING-FEE-2028 = EUR:0.01
|
||||
CLOSING-FEE-2029 = EUR:0.01
|
||||
CLOSING-FEE-2030 = EUR:0.01
|
||||
CLOSING-FEE-2031 = EUR:0.01
|
||||
CLOSING-FEE-2032 = EUR:0.01
|
||||
CLOSING-FEE-2033 = EUR:0.01
|
||||
CLOSING-FEE-2034 = EUR:0.01
|
||||
CLOSING-FEE-2035 = EUR:0.01
|
||||
|
||||
|
||||
[fees-sepa]
|
||||
# Fees for the forseeable future...
|
||||
|
@ -60,8 +60,7 @@
|
||||
struct GNUNET_TIME_Absolute now;
|
||||
|
||||
/**
|
||||
* Adds to the current time. XXX, open question: shall we
|
||||
* also _set_ the global current time after the faking?
|
||||
* Adds to the current time.
|
||||
*
|
||||
* @param relative number of _seconds_ to add to the current time.
|
||||
* @return a new absolute time, modified according to @e relative.
|
||||
@ -71,6 +70,9 @@ struct GNUNET_TIME_Absolute now;
|
||||
(now, \
|
||||
GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, \
|
||||
secs))
|
||||
#define JAN1971 "1971-01-01"
|
||||
#define JAN2030 "2030-01-01"
|
||||
|
||||
/**
|
||||
* Exchange base URL; mainly purpose is to make the compiler happy.
|
||||
*/
|
||||
@ -81,6 +83,24 @@ static char *exchange_url;
|
||||
*/
|
||||
static char *auditor_url;
|
||||
|
||||
/**
|
||||
* Wrapper around the time parser.
|
||||
*
|
||||
* @param str human-readable time string.
|
||||
* @return the parsed time from @a str.
|
||||
*/
|
||||
static struct GNUNET_TIME_Absolute
|
||||
TTH_parse_time (const char *str)
|
||||
{
|
||||
struct GNUNET_TIME_Absolute ret;
|
||||
|
||||
GNUNET_assert
|
||||
(GNUNET_OK == GNUNET_STRINGS_fancy_time_to_absolute (str,
|
||||
&ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Main function that will tell the interpreter what commands to
|
||||
* run.
|
||||
@ -92,9 +112,11 @@ run (void *cls,
|
||||
struct TALER_TESTING_Interpreter *is)
|
||||
{
|
||||
struct TALER_TESTING_Command keys_serialization[] = {
|
||||
|
||||
TALER_TESTING_cmd_serialize_keys ("serialize-keys"),
|
||||
TALER_TESTING_cmd_connect_with_state ("reconnect-with-state",
|
||||
"serialize-keys"),
|
||||
|
||||
TALER_TESTING_cmd_wire ("verify-/wire-with-serialized-keys",
|
||||
"x-taler-bank",
|
||||
NULL,
|
||||
@ -104,25 +126,15 @@ run (void *cls,
|
||||
*/
|
||||
TALER_TESTING_cmd_exec_keyup ("keyup-serialization",
|
||||
CONFIG_FILE_EXTENDED_2),
|
||||
TALER_TESTING_cmd_exec_auditor_sign
|
||||
("auditor-sign-serialization",
|
||||
CONFIG_FILE_EXTENDED_2),
|
||||
|
||||
TALER_TESTING_cmd_sleep ("sleep-serialization",
|
||||
3),
|
||||
TALER_TESTING_cmd_signal ("reload-keys-serialization",
|
||||
is->exchanged,
|
||||
SIGUSR1),
|
||||
TALER_TESTING_cmd_sleep ("sleep-serialization",
|
||||
3),
|
||||
#if 0
|
||||
|
||||
FIXME: #5672
|
||||
|
||||
The test below fails on different systems. Infact, different
|
||||
systems can generate different "anchors" values for their denoms,
|
||||
therefore the fixed value required by the test below (45) is
|
||||
condemned to fail.
|
||||
systems can generate different "anchors" values for their
|
||||
denoms, therefore the fixed value required by the test below
|
||||
(45) is condemned to fail.
|
||||
|
||||
However, this seems to happen only when very big values are
|
||||
used for the "lookahead_sign" value. Here we use 3500 seconds,
|
||||
@ -159,59 +171,36 @@ run (void *cls,
|
||||
is->exchanged,
|
||||
SIGUSR1),
|
||||
/**
|
||||
* 1 DK with 80s withdraw duration. Lookahead_sign is 60s.
|
||||
* 1 DK with 80s withdraw duration, lookahead_sign is 60s
|
||||
* => expect 1 DK.
|
||||
*/
|
||||
TALER_TESTING_cmd_check_keys ("check-keys-1",
|
||||
1, /* generation */
|
||||
1),
|
||||
/**
|
||||
* We now set lookahead_sign to 90s, and expect a new DK
|
||||
* to be created. The first one lives (= has withdraw_duration of)
|
||||
* only 80s.
|
||||
* This has a lookahead_sign == 60, and DK withdraw_time == 80
|
||||
* => one DK should be created.
|
||||
*/
|
||||
TALER_TESTING_cmd_exec_keyup ("keyup-2",
|
||||
CONFIG_FILE_EXTENDED),
|
||||
|
||||
TALER_TESTING_cmd_exec_auditor_sign ("sign-keys-1",
|
||||
CONFIG_FILE_EXTENDED),
|
||||
|
||||
TALER_TESTING_cmd_signal ("trigger-keys-reload-1",
|
||||
is->exchanged,
|
||||
SIGUSR1),
|
||||
/**
|
||||
* Total 2 DKs.
|
||||
TALER_TESTING_cmd_exec_keyup_with_now ("keyup-serialization",
|
||||
CONFIG_FILE,
|
||||
TTH_parse_time (JAN2030)),
|
||||
/**
|
||||
* Should return 1 key, + the original one = 2.
|
||||
*/
|
||||
TALER_TESTING_cmd_check_keys ("check-keys-2",
|
||||
2, /* generation */
|
||||
2),
|
||||
TALER_TESTING_cmd_check_keys_with_now
|
||||
("check-keys-2",
|
||||
2, /* generation */
|
||||
2,
|
||||
TTH_parse_time (JAN2030)),
|
||||
|
||||
/* Nothing should happen now. */
|
||||
TALER_TESTING_cmd_exec_keyup ("keyup-3",
|
||||
CONFIG_FILE_EXTENDED),
|
||||
TALER_TESTING_cmd_exec_auditor_sign ("sign-keys-2",
|
||||
CONFIG_FILE),
|
||||
TALER_TESTING_cmd_signal ("trigger-keys-reload-2",
|
||||
is->exchanged,
|
||||
SIGUSR1),
|
||||
|
||||
/**
|
||||
* Make 30s time lapse (by passing the "now" argument to
|
||||
* "/keys"). First DK has 50s of remaining life
|
||||
* (duration_withdraw). The second DK has ~60s of remaining
|
||||
* life, therefore two keys should be (still) returned.
|
||||
*/
|
||||
TALER_TESTING_cmd_check_keys_with_now ("check-keys-3",
|
||||
3,
|
||||
2,
|
||||
NOWPLUSSECS (30)),
|
||||
TALER_TESTING_cmd_end ()
|
||||
};
|
||||
struct TALER_TESTING_Command commands[] = {
|
||||
|
||||
TALER_TESTING_cmd_batch ("ordinary-cherry-pick",
|
||||
ordinary_cherry_pick),
|
||||
TALER_TESTING_cmd_batch ("keys-serialization",
|
||||
keys_serialization),
|
||||
/*TALER_TESTING_cmd_batch ("keys-serialization",
|
||||
keys_serialization),*/
|
||||
TALER_TESTING_cmd_end ()
|
||||
};
|
||||
|
||||
|
@ -19,7 +19,14 @@
|
||||
|
||||
/**
|
||||
* @file exchange-lib/testing_api_cmd_check_keys.c
|
||||
* @brief Implementation of "check keys" test command.
|
||||
* @brief Implementation of "check keys" test command. XXX-NOTE:
|
||||
* the number of 'expected keys' is NOT the number of the
|
||||
* downloaded keys, but rather the number of keys that the
|
||||
* libtalerutil library keeps locally. As for the current
|
||||
* design, keys are _never_ discarded by the library,
|
||||
* therefore their (expected) number is monotonically
|
||||
* ascending.
|
||||
*
|
||||
* @author Marcello Stanisci
|
||||
*/
|
||||
|
||||
@ -149,7 +156,7 @@ check_keys_run (void *cls,
|
||||
TALER_TESTING_interpreter_fail (is);
|
||||
return;
|
||||
}
|
||||
/* /keys was updated, let's check they were OK! */
|
||||
/* "/keys" was updated, let's check they were OK! */
|
||||
if (cks->num_denom_keys != is->keys->num_denom_keys)
|
||||
{
|
||||
/* Did not get the expected number of denomination keys! */
|
||||
@ -300,6 +307,9 @@ TALER_TESTING_cmd_check_keys_with_now
|
||||
cks->now = now;
|
||||
cks->with_now = GNUNET_YES;
|
||||
|
||||
/* Force to NOT cherry pick, otherwise they conflict. */
|
||||
cks->pull_all_keys = GNUNET_YES;
|
||||
|
||||
struct TALER_TESTING_Command cmd = {
|
||||
.cls = cks,
|
||||
.label = label,
|
||||
|
@ -620,7 +620,6 @@ TALER_TESTING_cert_cb
|
||||
(GNUNET_ERROR_TYPE_ERROR,
|
||||
"Got NULL response for /keys"
|
||||
" during execution!\n");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user