make DB reset optional in API, use it in tests, but not in the benchmark

This commit is contained in:
Christian Grothoff 2020-03-19 17:56:23 +01:00
parent fd29d1866f
commit 15489275ba
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
11 changed files with 22 additions and 6 deletions

View File

@ -952,6 +952,7 @@ main (int argc,
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==
TALER_TESTING_prepare_exchange (cfg_filename, TALER_TESTING_prepare_exchange (cfg_filename,
GNUNET_NO,
&ec)); &ec));
} }
else else

View File

@ -118,12 +118,14 @@ struct TALER_TESTING_DatabaseConnection
* launch the exchange process itself. * launch the exchange process itself.
* *
* @param config_filename configuration file to use * @param config_filename configuration file to use
* @param reset_db should we reset the database
* @param[out] ec will be set to the exchange configuration data * @param[out] ec will be set to the exchange configuration data
* @return #GNUNET_OK on success, #GNUNET_NO if test should be * @return #GNUNET_OK on success, #GNUNET_NO if test should be
* skipped, #GNUNET_SYSERR on test failure * skipped, #GNUNET_SYSERR on test failure
*/ */
int int
TALER_TESTING_prepare_exchange (const char *config_filename, TALER_TESTING_prepare_exchange (const char *config_filename,
int reset_db,
struct TALER_TESTING_ExchangeConfiguration *ec); struct TALER_TESTING_ExchangeConfiguration *ec);

View File

@ -73,6 +73,7 @@ TALER_JSON_get_error_code (const json_t *json)
if (NULL == json) if (NULL == json)
{ {
abort ();
GNUNET_break_op (0); GNUNET_break_op (0);
return TALER_EC_INVALID_RESPONSE; return TALER_EC_INVALID_RESPONSE;
} }

View File

@ -683,6 +683,7 @@ main (int argc,
* fetches the port number from config in order to see * fetches the port number from config in order to see
* if it's available. */ * if it's available. */
switch (TALER_TESTING_prepare_exchange (CONFIG_FILE, switch (TALER_TESTING_prepare_exchange (CONFIG_FILE,
GNUNET_YES,
&ec)) &ec))
{ {
case GNUNET_SYSERR: case GNUNET_SYSERR:

View File

@ -809,6 +809,7 @@ main (int argc,
* fetches the port number from config in order to see * fetches the port number from config in order to see
* if it's available. */ * if it's available. */
switch (TALER_TESTING_prepare_exchange (CONFIG_FILE, switch (TALER_TESTING_prepare_exchange (CONFIG_FILE,
GNUNET_YES,
&ec)) &ec))
{ {
case GNUNET_SYSERR: case GNUNET_SYSERR:

View File

@ -237,6 +237,7 @@ main (int argc,
* fetches the port number from config in order to see * fetches the port number from config in order to see
* if it's available. */ * if it's available. */
switch (TALER_TESTING_prepare_exchange (CONFIG_FILE, switch (TALER_TESTING_prepare_exchange (CONFIG_FILE,
GNUNET_YES,
&ec)) &ec))
{ {
case GNUNET_SYSERR: case GNUNET_SYSERR:

View File

@ -101,6 +101,7 @@ main (int argc,
* fetches the port number from config in order to see * fetches the port number from config in order to see
* if it's available. */ * if it's available. */
switch (TALER_TESTING_prepare_exchange (CONFIG_FILE, switch (TALER_TESTING_prepare_exchange (CONFIG_FILE,
GNUNET_YES,
&ec)) &ec))
{ {
case GNUNET_SYSERR: case GNUNET_SYSERR:

View File

@ -212,6 +212,7 @@ main (int argc,
* fetches the port number from config in order to see * fetches the port number from config in order to see
* if it's available. */ * if it's available. */
switch (TALER_TESTING_prepare_exchange (CONFIG_FILE, switch (TALER_TESTING_prepare_exchange (CONFIG_FILE,
GNUNET_YES,
&ec)) &ec))
{ {
case GNUNET_SYSERR: case GNUNET_SYSERR:

View File

@ -528,6 +528,7 @@ main (int argc,
TALER_TESTING_cleanup_files (config_filename); TALER_TESTING_cleanup_files (config_filename);
if (GNUNET_OK != TALER_TESTING_prepare_exchange (config_filename, if (GNUNET_OK != TALER_TESTING_prepare_exchange (config_filename,
GNUNET_YES,
&ec)) &ec))
{ {
TALER_LOG_WARNING ("Could not prepare the exchange.\n"); TALER_LOG_WARNING ("Could not prepare the exchange.\n");

View File

@ -170,6 +170,7 @@ main (int argc,
TALER_TESTING_cleanup_files (config_filename); TALER_TESTING_cleanup_files (config_filename);
if (GNUNET_OK != TALER_TESTING_prepare_exchange (config_filename, if (GNUNET_OK != TALER_TESTING_prepare_exchange (config_filename,
GNUNET_YES,
&ec)) &ec))
{ {
TALER_LOG_INFO ("Could not prepare the exchange\n"); TALER_LOG_INFO ("Could not prepare the exchange\n");

View File

@ -490,12 +490,14 @@ fail:
* launch the exchange process itself. * launch the exchange process itself.
* *
* @param config_filename configuration file to use * @param config_filename configuration file to use
* @param reset_db should we reset the database?
* @param[out] ec will be set to the exchange configuration data * @param[out] ec will be set to the exchange configuration data
* @return #GNUNET_OK on success, #GNUNET_NO if test should be * @return #GNUNET_OK on success, #GNUNET_NO if test should be
* skipped, #GNUNET_SYSERR on test failure * skipped, #GNUNET_SYSERR on test failure
*/ */
int int
TALER_TESTING_prepare_exchange (const char *config_filename, TALER_TESTING_prepare_exchange (const char *config_filename,
int reset_db,
struct TALER_TESTING_ExchangeConfiguration *ec) struct TALER_TESTING_ExchangeConfiguration *ec)
{ {
struct SignInfo si = { struct SignInfo si = {
@ -508,12 +510,15 @@ TALER_TESTING_prepare_exchange (const char *config_filename,
TALER_TESTING_run_keyup (config_filename, TALER_TESTING_run_keyup (config_filename,
si.auditor_sign_input_filename)) si.auditor_sign_input_filename))
return GNUNET_NO; return GNUNET_NO;
if (GNUNET_OK != if (GNUNET_YES == reset_db)
TALER_TESTING_exchange_db_reset (config_filename)) {
return GNUNET_NO; if (GNUNET_OK !=
if (GNUNET_OK != TALER_TESTING_exchange_db_reset (config_filename))
TALER_TESTING_auditor_db_reset (config_filename)) return GNUNET_NO;
return GNUNET_NO; if (GNUNET_OK !=
TALER_TESTING_auditor_db_reset (config_filename))
return GNUNET_NO;
}
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_CONFIGURATION_parse_and_run (config_filename, GNUNET_CONFIGURATION_parse_and_run (config_filename,
&sign_keys_for_exchange, &sign_keys_for_exchange,