From a9ff9a0bbe39be3b0bc23ddebc13c0047d414554 Mon Sep 17 00:00:00 2001 From: Marcello Stanisci Date: Mon, 23 Apr 2018 17:20:14 +0200 Subject: [PATCH] reset auditor tables upon running tests, + upgrade "twisted" config file. --- .../test_exchange_api_twisted.conf | 34 +++++++++++++ src/exchange-lib/testing_api_helpers.c | 48 ++++++++++++++++++- 2 files changed, 81 insertions(+), 1 deletion(-) diff --git a/src/exchange-lib/test_exchange_api_twisted.conf b/src/exchange-lib/test_exchange_api_twisted.conf index b04d9f43f..2b52eb4a0 100644 --- a/src/exchange-lib/test_exchange_api_twisted.conf +++ b/src/exchange-lib/test_exchange_api_twisted.conf @@ -130,6 +130,40 @@ BANK_URL = "http://localhost:8082/" # From which account at the 'bank' should outgoing wire transfers be made? BANK_ACCOUNT_NUMBER = 2 +[account-2] +URL = payto://x-taler-bank/localhost:8082/2 +PLUGIN = taler_bank +WIRE_RESPONSE = ${TALER_CONFIG_HOME}/account-2.json +TALER_BANK_AUTH_METHOD = "basic" +USERNAME = user +PASSWORD = pass +ENABLE_DEBIT = YES +ENABLE_CREDIT = YES + +[fees-x-taler-bank] +# Fees for the forseeable future... +# If you see this after 2017, update to match the next 10 years... +WIRE-FEE-2018 = EUR:0.01 +WIRE-FEE-2019 = EUR:0.01 +WIRE-FEE-2020 = EUR:0.01 +WIRE-FEE-2021 = EUR:0.01 +WIRE-FEE-2022 = EUR:0.01 +WIRE-FEE-2023 = EUR:0.01 +WIRE-FEE-2024 = EUR:0.01 +WIRE-FEE-2025 = EUR:0.01 +WIRE-FEE-2026 = EUR:0.01 +WIRE-FEE-2027 = EUR:0.01 + +CLOSING-FEE-2018 = EUR:0.01 +CLOSING-FEE-2019 = EUR:0.01 +CLOSING-FEE-2020 = EUR:0.01 +CLOSING-FEE-2021 = EUR:0.01 +CLOSING-FEE-2022 = EUR:0.01 +CLOSING-FEE-2023 = EUR:0.01 +CLOSING-FEE-2024 = EUR:0.01 +CLOSING-FEE-2025 = EUR:0.01 +CLOSING-FEE-2026 = EUR:0.01 +CLOSING-FEE-2027 = EUR:0.01 [coin_eur_ct_1] value = EUR:0.01 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; }