libeufin-based bank API test

Give Nexus and Sandbox one database each,
in order to reduce concurrent accesses to
the sqlite3 file.
This commit is contained in:
MS 2023-01-13 22:59:22 +01:00
parent f8ddd0b685
commit 50a33389da
No known key found for this signature in database
GPG Key ID: 8D526861953F4C0F
2 changed files with 21 additions and 14 deletions

View File

@ -207,10 +207,10 @@ main (int argc,
with_libeufin = GNUNET_YES; with_libeufin = GNUNET_YES;
cfgfile = CONFIG_FILE_NEXUS; cfgfile = CONFIG_FILE_NEXUS;
if (GNUNET_OK != if (GNUNET_OK !=
TALER_TESTING_prepare_nexus (CONFIG_FILE_NEXUS, TALER_TESTING_prepare_libeufin (CONFIG_FILE_NEXUS,
GNUNET_YES, GNUNET_YES,
"exchange-account-2", "exchange-account-2",
&bc)) &bc))
{ {
GNUNET_break (0); GNUNET_break (0);
return 77; return 77;

View File

@ -92,11 +92,10 @@ TALER_TESTING_run_libeufin (const struct TALER_TESTING_BankConfiguration *bc)
struct TALER_TESTING_LibeufinServices ret = { 0 }; struct TALER_TESTING_LibeufinServices ret = { 0 };
unsigned int iter; unsigned int iter;
char *curl_check_cmd; char *curl_check_cmd;
const char *db_conn = "jdbc:sqlite:/tmp/libeufin-exchange-test.sqlite3";
setenv ( setenv (
"LIBEUFIN_NEXUS_DB_CONNECTION", "LIBEUFIN_NEXUS_DB_CONNECTION",
db_conn, "jdbc:sqlite:/tmp/libeufin-exchange-test-nexusdb.sqlite3",
1); // not overwriting any potentially existing DB. 1); // not overwriting any potentially existing DB.
nexus_proc = GNUNET_OS_start_process ( nexus_proc = GNUNET_OS_start_process (
@ -146,8 +145,8 @@ TALER_TESTING_run_libeufin (const struct TALER_TESTING_BankConfiguration *bc)
fprintf (stderr, "\n"); fprintf (stderr, "\n");
setenv ( setenv (
"LIBEUFIN_SANDBOX_DB_CONNECTION", "LIBEUFIN_SANDBOX_DB_CONNECTION",
db_conn, "jdbc:sqlite:/tmp/libeufin-exchange-test-sandboxdb.sqlite3",
1); // not overwriting existing any potentially existing DB. 1); // not overwriting any potentially existing DB.
setenv ( setenv (
"LIBEUFIN_SANDBOX_ADMIN_PASSWORD", "LIBEUFIN_SANDBOX_ADMIN_PASSWORD",
"secret", "secret",
@ -299,10 +298,10 @@ TALER_TESTING_run_bank (const char *config_filename,
enum GNUNET_GenericReturnValue enum GNUNET_GenericReturnValue
TALER_TESTING_prepare_nexus (const char *config_filename, TALER_TESTING_prepare_libeufin (const char *config_filename,
int reset_db, int reset_db,
const char *config_section, const char *config_section,
struct TALER_TESTING_BankConfiguration *bc) struct TALER_TESTING_BankConfiguration *bc)
{ {
struct GNUNET_CONFIGURATION_Handle *cfg; struct GNUNET_CONFIGURATION_Handle *cfg;
unsigned long long port; unsigned long long port;
@ -367,10 +366,18 @@ TALER_TESTING_prepare_nexus (const char *config_filename,
/* DB preparation */ /* DB preparation */
if (GNUNET_YES == reset_db) if (GNUNET_YES == reset_db)
{ {
if (0 != system ("rm -f /tmp/libeufin-exchange-test.sqlite3")) if (0 != system ("rm -f /tmp/libeufin-exchange-test-nexusdb.sqlite3"))
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to invoke db-removal command.\n"); "Failed to invoke db-removal command on nexusdb.\n");
GNUNET_free (database);
GNUNET_CONFIGURATION_destroy (cfg);
return GNUNET_SYSERR;
}
if (0 != system ("rm -f /tmp/libeufin-exchange-test-sandboxdb.sqlite3"))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to invoke db-removal command on sandboxdb.\n");
GNUNET_free (database); GNUNET_free (database);
GNUNET_CONFIGURATION_destroy (cfg); GNUNET_CONFIGURATION_destroy (cfg);
return GNUNET_SYSERR; return GNUNET_SYSERR;