From 1fc8fd22dc417f151e28a63dfc6fd58cf4b10b2e Mon Sep 17 00:00:00 2001 From: Marcello Stanisci Date: Thu, 16 Jan 2020 14:40:28 +0100 Subject: Aggregator tests execute first CMD. --- .../test-taler-exchange-aggregator-postgres.conf | 10 ++++-- src/lib/test_taler_exchange_aggregator.c | 38 +++++++++++++++------- 2 files changed, 34 insertions(+), 14 deletions(-) (limited to 'src/lib') diff --git a/src/lib/test-taler-exchange-aggregator-postgres.conf b/src/lib/test-taler-exchange-aggregator-postgres.conf index b6c18fd5b..9ee6c6b0f 100644 --- a/src/lib/test-taler-exchange-aggregator-postgres.conf +++ b/src/lib/test-taler-exchange-aggregator-postgres.conf @@ -20,6 +20,12 @@ MASTER_PUBLIC_KEY = 98NJW3CQHZQGQXTY3K85K531XKPAPAVV4Q5V8PYYRR00NJGZWNVG # the tracking API. BASE_URL = "https://exchange.taler.net/" +[auditor] +BASE_URL = "http://auditor.example.com/" + +[auditordb-postgres] +CONFIG = "postgres:///talercheck" + [exchangedb] # After how long do we close idle reserves? The exchange # and the auditor must agree on this value. We currently @@ -34,7 +40,6 @@ IDLE_RESERVE_EXPIRATION_TIME = 4 weeks #The connection string the plugin has to use for connecting to the database CONFIG = postgres:///talercheck - [exchangedb] # After how long do we close idle reserves? The exchange @@ -53,9 +58,8 @@ LEGAL_RESERVE_EXPIRATION_TIME = 7 years # What is the account URL? URL = "payto://x-taler-bank/localhost:8082/3" - +method = "x-taler-bank" WIRE_RESPONSE = ${TALER_CONFIG_HOME}/account-1.json -PLUGIN = "taler_bank" ENABLE_DEBIT = YES ENABLE_CREDIT = YES TALER_BANK_AUTH_METHOD = NONE diff --git a/src/lib/test_taler_exchange_aggregator.c b/src/lib/test_taler_exchange_aggregator.c index 3ad14d34f..075effc2d 100644 --- a/src/lib/test_taler_exchange_aggregator.c +++ b/src/lib/test_taler_exchange_aggregator.c @@ -116,6 +116,7 @@ fake_coin (struct TALER_CoinPublicInfo *coin) } +#if 0 /** * Helper function to fake a deposit operation. * @@ -208,6 +209,7 @@ do_deposit (struct Command *cmd) json_decref (deposit.receiver_wire_account); return ret; } +#endif /** * Interprets the commands from the test program. @@ -867,7 +869,8 @@ run_test () * otherwise GNUNET_OK */ static int -prepare_database (const struct GNUNET_CONFIGURATION_Handle *cfg) +prepare_database (void *cls, + const struct GNUNET_CONFIGURATION_Handle *cfg) { // connect to the database. @@ -896,13 +899,20 @@ prepare_database (const struct GNUNET_CONFIGURATION_Handle *cfg) } +/** + * Collects all the tests. + */ static void run (void *cls, struct TALER_TESTING_Interpreter *is) { - if (GNUNET_OK != prepare_database (is->cfg)) - return; - + struct TALER_TESTING_Command all[] = { + TALER_TESTING_cmd_end () + }; + + TALER_TESTING_run_with_fakebank (is, + all, + bc.bank_url); } int @@ -915,11 +925,6 @@ main (int argc, struct GNUNET_CONFIGURATION_Handle *cfg; struct GNUNET_SIGNAL_Context *shc_chld; - - /* these might get in the way */ - unsetenv ("XDG_DATA_HOME"); - unsetenv ("XDG_CONFIG_HOME"); - if (NULL == (plugin_name = strrchr (argv[0], (int) '-'))) { GNUNET_break (0); @@ -937,13 +942,17 @@ main (int argc, "DEBUG", NULL); - + /* these might get in the way */ + unsetenv ("XDG_DATA_HOME"); + unsetenv ("XDG_CONFIG_HOME"); TALER_TESTING_cleanup_files (config_filename); + + // BUG: FAILS NOW. if (GNUNET_OK != TALER_TESTING_prepare_exchange (config_filename, &ec)) { - TALER_LOG_WARNING ("Could not prepare the exchange (keyup, ..)\n"); + TALER_LOG_WARNING ("Could not prepare the exchange.\n"); return 77; } @@ -958,6 +967,13 @@ main (int argc, coin_pk = GNUNET_CRYPTO_rsa_private_key_create (1024); coin_pub = GNUNET_CRYPTO_rsa_private_key_get_public (coin_pk); + if (GNUNET_OK != GNUNET_CONFIGURATION_parse_and_run (config_filename, + &prepare_database, + NULL)) + { + TALER_LOG_WARNING ("Could not prepare database for tests.\n"); + return result; + } result = TALER_TESTING_setup (&run, NULL, -- cgit v1.2.3