diff options
author | Marcello Stanisci <stanisci.m@gmail.com> | 2019-01-16 19:44:44 +0100 |
---|---|---|
committer | Marcello Stanisci <stanisci.m@gmail.com> | 2019-01-16 19:44:44 +0100 |
commit | 448a57d81e2a72d8117603ee60f60e5586c7d05d (patch) | |
tree | eb21973b67387378248d8698766ea3016ae1438c /src/lib/testing_api_cmd_check_keys.c | |
parent | ece3a9bfdb6419d344abeb6c78c167b80d81fb6b (diff) | |
download | exchange-448a57d81e2a72d8117603ee60f60e5586c7d05d.tar.gz exchange-448a57d81e2a72d8117603ee60f60e5586c7d05d.tar.bz2 exchange-448a57d81e2a72d8117603ee60f60e5586c7d05d.zip |
Extend tests.
Give a way to force redownload (= no cherry picking) all /keys.
Diffstat (limited to 'src/lib/testing_api_cmd_check_keys.c')
-rw-r--r-- | src/lib/testing_api_cmd_check_keys.c | 55 |
1 files changed, 53 insertions, 2 deletions
diff --git a/src/lib/testing_api_cmd_check_keys.c b/src/lib/testing_api_cmd_check_keys.c index d329f31a4..6cd605c38 100644 --- a/src/lib/testing_api_cmd_check_keys.c +++ b/src/lib/testing_api_cmd_check_keys.c @@ -47,6 +47,13 @@ struct CheckKeysState * supposed to have. */ unsigned int num_denom_keys; + + /** + * If this value is GNUNET_YES, then the "cherry + * picking" facility is turned off; whole /keys is + * downloaded. + */ + unsigned int pull_all_keys; }; @@ -77,8 +84,11 @@ check_keys_run (void *cls, cmd->label); /* Means re-download /keys. */ - GNUNET_break (0 == TALER_EXCHANGE_check_keys_current - (is->exchange, GNUNET_YES).abs_value_us); + GNUNET_break + (0 == TALER_EXCHANGE_check_keys_current + (is->exchange, + GNUNET_YES, + cks->pull_all_keys).abs_value_us); return; } if (is->key_generation > cks->generation) @@ -162,4 +172,45 @@ TALER_TESTING_cmd_check_keys return cmd; } + +/** + * Make a "check keys" command that forcedly does NOT cherry pick; + * just redownload the whole /keys. Then checks whether the number + * of denomination keys from @a exchange matches @a num_denom_keys. + * + * @param label command label + * @param generation when this command is run, exactly @a + * generation /keys downloads took place. If the number + * of downloads is less than @a generation, the logic will + * first make sure that @a generation downloads are done, + * and _then_ execute the rest of the command. + * @param num_denom_keys expected number of denomination keys. + * @param exchange connection handle to the exchange to test. + * + * @return the command. + */ +struct TALER_TESTING_Command +TALER_TESTING_cmd_check_keys_pull_all_keys + (const char *label, + unsigned int generation, + unsigned int num_denom_keys) +{ + struct CheckKeysState *cks; + + cks = GNUNET_new (struct CheckKeysState); + cks->generation = generation; + cks->num_denom_keys = num_denom_keys; + cks->pull_all_keys = GNUNET_YES; + + struct TALER_TESTING_Command cmd = { + .cls = cks, + .label = label, + .run = &check_keys_run, + .cleanup = &check_keys_cleanup + }; + + return cmd; +} + + /* end of testing_api_cmd_check_keys.c */ |