From a9ff9a0bbe39be3b0bc23ddebc13c0047d414554 Mon Sep 17 00:00:00 2001 From: Marcello Stanisci Date: Mon, 23 Apr 2018 17:20:14 +0200 Subject: reset auditor tables upon running tests, + upgrade "twisted" config file. --- src/exchange-lib/testing_api_helpers.c | 48 +++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) (limited to 'src/exchange-lib/testing_api_helpers.c') diff --git a/src/exchange-lib/testing_api_helpers.c b/src/exchange-lib/testing_api_helpers.c index 8bf66efb4..31f28d024 100644 --- a/src/exchange-lib/testing_api_helpers.c +++ b/src/exchange-lib/testing_api_helpers.c @@ -185,6 +185,7 @@ TALER_TESTING_prepare_exchange (const char *config_filename, GNUNET_OS_process_wait (proc); GNUNET_OS_process_destroy (proc); + /* Reset exchange database. */ proc = GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_ALL, NULL, NULL, NULL, @@ -215,7 +216,7 @@ TALER_TESTING_prepare_exchange (const char *config_filename, (0 != code) ) { fprintf (stderr, - "Failed to setup database\n"); + "Failed to setup (exchange) database\n"); return GNUNET_NO; } if ( (type != GNUNET_OS_PROCESS_EXITED) || @@ -227,6 +228,51 @@ TALER_TESTING_prepare_exchange (const char *config_filename, return GNUNET_SYSERR; } + + /* Reset auditor database. */ + + proc = GNUNET_OS_start_process (GNUNET_NO, + GNUNET_OS_INHERIT_STD_ALL, + NULL, NULL, NULL, + "taler-auditor-dbinit", + "taler-auditor-dbinit", + "-c", config_filename, + "-r", + NULL); + if (NULL == proc) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Failed to run `taler-auditor-dbinit`," + " is your PATH correct?\n"); + + return GNUNET_NO; + } + if (GNUNET_SYSERR == + GNUNET_OS_process_wait_status (proc, + &type, + &code)) + { + GNUNET_break (0); + GNUNET_OS_process_destroy (proc); + return GNUNET_SYSERR; + } + GNUNET_OS_process_destroy (proc); + if ( (type == GNUNET_OS_PROCESS_EXITED) && + (0 != code) ) + { + fprintf (stderr, + "Failed to setup (auditor) database\n"); + return GNUNET_NO; + } + if ( (type != GNUNET_OS_PROCESS_EXITED) || + (0 != code) ) + { + fprintf (stderr, + "Unexpected error running" + " `taler-auditor-dbinit'!\n"); + return GNUNET_SYSERR; + } + return GNUNET_OK; } -- cgit v1.2.3