Re-enabling keys serialization test.
This commit is contained in:
parent
25f444a361
commit
ba4ded3d6e
@ -1570,9 +1570,10 @@ deserialize_data (struct TALER_EXCHANGE_Handle *exchange,
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Serialize the latest key data from @a exchange to be persisted on
|
* Serialize the latest key data from @a
|
||||||
* disk (to be used with #TALER_EXCHANGE_OPTION_DATA to more
|
* exchange to be persisted on disk (to be used with
|
||||||
* efficiently recover the state).
|
* #TALER_EXCHANGE_OPTION_DATA to more efficiently recover
|
||||||
|
* the state).
|
||||||
*
|
*
|
||||||
* @param exchange which exchange's key and wire data should be
|
* @param exchange which exchange's key and wire data should be
|
||||||
* serialized
|
* serialized
|
||||||
@ -1580,7 +1581,8 @@ deserialize_data (struct TALER_EXCHANGE_Handle *exchange,
|
|||||||
* otherwise JSON object owned by the caller
|
* otherwise JSON object owned by the caller
|
||||||
*/
|
*/
|
||||||
json_t *
|
json_t *
|
||||||
TALER_EXCHANGE_serialize_data (struct TALER_EXCHANGE_Handle *exchange)
|
TALER_EXCHANGE_serialize_data
|
||||||
|
(struct TALER_EXCHANGE_Handle *exchange)
|
||||||
{
|
{
|
||||||
const struct TALER_EXCHANGE_Keys *kd = &exchange->key_data;
|
const struct TALER_EXCHANGE_Keys *kd = &exchange->key_data;
|
||||||
struct GNUNET_TIME_Absolute now;
|
struct GNUNET_TIME_Absolute now;
|
||||||
@ -1600,15 +1602,20 @@ TALER_EXCHANGE_serialize_data (struct TALER_EXCHANGE_Handle *exchange)
|
|||||||
continue; /* skip keys that have expired */
|
continue; /* skip keys that have expired */
|
||||||
signkey = json_pack ("{s:o, s:o, s:o, s:o, s:o}",
|
signkey = json_pack ("{s:o, s:o, s:o, s:o, s:o}",
|
||||||
"key",
|
"key",
|
||||||
GNUNET_JSON_from_data_auto (&sk->key),
|
GNUNET_JSON_from_data_auto
|
||||||
|
(&sk->key),
|
||||||
"master_sig",
|
"master_sig",
|
||||||
GNUNET_JSON_from_data_auto (&sk->master_sig),
|
GNUNET_JSON_from_data_auto
|
||||||
|
(&sk->master_sig),
|
||||||
"stamp_start",
|
"stamp_start",
|
||||||
GNUNET_JSON_from_time_abs (sk->valid_from),
|
GNUNET_JSON_from_time_abs
|
||||||
|
(sk->valid_from),
|
||||||
"stamp_expire",
|
"stamp_expire",
|
||||||
GNUNET_JSON_from_time_abs (sk->valid_until),
|
GNUNET_JSON_from_time_abs
|
||||||
|
(sk->valid_until),
|
||||||
"stamp_end",
|
"stamp_end",
|
||||||
GNUNET_JSON_from_time_abs (sk->valid_legal));
|
GNUNET_JSON_from_time_abs
|
||||||
|
(sk->valid_legal));
|
||||||
if (NULL == signkey)
|
if (NULL == signkey)
|
||||||
{
|
{
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
@ -1839,7 +1846,7 @@ request_keys (void *cls)
|
|||||||
|
|
||||||
if (GNUNET_YES == exchange->with_now)
|
if (GNUNET_YES == exchange->with_now)
|
||||||
{
|
{
|
||||||
TALER_LOG_DEBUG ("Faking now to GET /keys): %s\n",
|
TALER_LOG_DEBUG ("Faking now to GET /keys: %s\n",
|
||||||
GNUNET_STRINGS_absolute_time_to_string (exchange->now));
|
GNUNET_STRINGS_absolute_time_to_string (exchange->now));
|
||||||
sprintf (&url[strlen (url)],
|
sprintf (&url[strlen (url)],
|
||||||
"now=%llu&",
|
"now=%llu&",
|
||||||
|
@ -54,6 +54,9 @@
|
|||||||
#define CONFIG_FILE_EXTENDED_2 \
|
#define CONFIG_FILE_EXTENDED_2 \
|
||||||
"test_exchange_api_keys_cherry_picking_extended_2.conf"
|
"test_exchange_api_keys_cherry_picking_extended_2.conf"
|
||||||
|
|
||||||
|
|
||||||
|
#define NDKS_RIGHT_BEFORE_SERIALIZATION 46
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add seconds.
|
* Add seconds.
|
||||||
*
|
*
|
||||||
@ -128,52 +131,28 @@ run (void *cls,
|
|||||||
TALER_TESTING_cmd_connect_with_state
|
TALER_TESTING_cmd_connect_with_state
|
||||||
("reconnect-with-state",
|
("reconnect-with-state",
|
||||||
"serialize-keys"),
|
"serialize-keys"),
|
||||||
|
/**
|
||||||
|
* Make sure we have the same keys situation as
|
||||||
|
* it was before the serialization.
|
||||||
|
*/
|
||||||
|
TALER_TESTING_cmd_check_keys_with_now
|
||||||
|
("check-keys-after-deserialization",
|
||||||
|
4,
|
||||||
|
NDKS_RIGHT_BEFORE_SERIALIZATION,
|
||||||
|
/**
|
||||||
|
* Pretend 5 seconds passed.
|
||||||
|
*/
|
||||||
|
ADDSECS (TTH_parse_time (JAN2030),
|
||||||
|
5)),
|
||||||
|
/**
|
||||||
|
* Use one of the deserialized keys.
|
||||||
|
*/
|
||||||
TALER_TESTING_cmd_wire
|
TALER_TESTING_cmd_wire
|
||||||
("verify-/wire-with-serialized-keys",
|
("verify-/wire-with-serialized-keys",
|
||||||
"x-taler-bank",
|
"x-taler-bank",
|
||||||
NULL,
|
NULL,
|
||||||
MHD_HTTP_OK),
|
MHD_HTTP_OK),
|
||||||
|
|
||||||
/**
|
|
||||||
* This loads a very big lookahead_sign (3500s).
|
|
||||||
*/
|
|
||||||
TALER_TESTING_cmd_exec_keyup
|
|
||||||
("keyup-serialization",
|
|
||||||
CONFIG_FILE_EXTENDED_2),
|
|
||||||
|
|
||||||
#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.
|
|
||||||
|
|
||||||
However, this seems to happen only when very big values are
|
|
||||||
used for the "lookahead_sign" value. Here we use 3500 seconds,
|
|
||||||
and the test breaks.
|
|
||||||
|
|
||||||
A reasonable fix is to allow for some slack in the number of
|
|
||||||
the expected keys.
|
|
||||||
|
|
||||||
TALER_TESTING_cmd_check_keys ("check-freshest-keys",
|
|
||||||
/* At this point, /keys has been
|
|
||||||
* downloaded roughly 6 times, so by
|
|
||||||
* forcing 10 here we make sure we get
|
|
||||||
* all the new ones. */
|
|
||||||
10,
|
|
||||||
/* We use a very high number here to make
|
|
||||||
* sure the "big" lookahead value got
|
|
||||||
* respected. */
|
|
||||||
45),
|
|
||||||
#endif
|
|
||||||
TALER_TESTING_cmd_wire ("verify-/wire-with-fresh-keys",
|
|
||||||
"x-taler-bank",
|
|
||||||
NULL,
|
|
||||||
MHD_HTTP_OK),
|
|
||||||
|
|
||||||
TALER_TESTING_cmd_end (),
|
TALER_TESTING_cmd_end (),
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -233,10 +212,11 @@ run (void *cls,
|
|||||||
* ----
|
* ----
|
||||||
* 46
|
* 46
|
||||||
*/
|
*/
|
||||||
|
|
||||||
TALER_TESTING_cmd_check_keys_with_now
|
TALER_TESTING_cmd_check_keys_with_now
|
||||||
("check-keys-3",
|
("check-keys-3",
|
||||||
3,
|
3,
|
||||||
46,
|
NDKS_RIGHT_BEFORE_SERIALIZATION,
|
||||||
TTH_parse_time (JAN2030)),
|
TTH_parse_time (JAN2030)),
|
||||||
|
|
||||||
TALER_TESTING_cmd_end ()
|
TALER_TESTING_cmd_end ()
|
||||||
@ -245,10 +225,8 @@ run (void *cls,
|
|||||||
|
|
||||||
TALER_TESTING_cmd_batch ("ordinary-cherry-pick",
|
TALER_TESTING_cmd_batch ("ordinary-cherry-pick",
|
||||||
ordinary_cherry_pick),
|
ordinary_cherry_pick),
|
||||||
/*
|
|
||||||
TALER_TESTING_cmd_batch ("keys-serialization",
|
TALER_TESTING_cmd_batch ("keys-serialization",
|
||||||
keys_serialization),
|
keys_serialization),
|
||||||
*/
|
|
||||||
TALER_TESTING_cmd_end ()
|
TALER_TESTING_cmd_end ()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user