summaryrefslogtreecommitdiff
path: root/src/exchange-lib/testing_api_helpers.c
diff options
context:
space:
mode:
authorMarcello Stanisci <stanisci.m@gmail.com>2018-04-23 17:20:14 +0200
committerMarcello Stanisci <stanisci.m@gmail.com>2018-04-23 17:20:14 +0200
commita9ff9a0bbe39be3b0bc23ddebc13c0047d414554 (patch)
treeb681e4e172f60ef95e941317c238e83ae0778fc3 /src/exchange-lib/testing_api_helpers.c
parenteedb4dd4edaf9874200c1b29de841b85f7a97d82 (diff)
downloadexchange-a9ff9a0bbe39be3b0bc23ddebc13c0047d414554.tar.gz
exchange-a9ff9a0bbe39be3b0bc23ddebc13c0047d414554.tar.bz2
exchange-a9ff9a0bbe39be3b0bc23ddebc13c0047d414554.zip
reset auditor tables upon running tests, + upgrade "twisted" config file.
Diffstat (limited to 'src/exchange-lib/testing_api_helpers.c')
-rw-r--r--src/exchange-lib/testing_api_helpers.c48
1 files changed, 47 insertions, 1 deletions
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;
}