diff options
-rw-r--r-- | .gitignore | 7 | ||||
-rw-r--r-- | src/lib/Makefile.am | 1 | ||||
-rw-r--r-- | src/lib/test-taler-exchange-wirewatch-postgres.conf | 30 | ||||
-rw-r--r-- | src/lib/test_taler_exchange_httpd_home/.config/taler/account-1.json | 4 | ||||
-rw-r--r-- | src/lib/test_taler_exchange_httpd_home/.local/share/taler/exchange/offline-keys/master.priv | 1 | ||||
-rw-r--r-- | src/lib/test_taler_exchange_wirewatch.c | 138 |
6 files changed, 104 insertions, 77 deletions
diff --git a/.gitignore b/.gitignore index 6e8473df2..278ce1c42 100644 --- a/.gitignore +++ b/.gitignore @@ -41,6 +41,12 @@ src/bank-lib/test_bank_api_with_fakebank src/bank-lib/test_bank_api_with_fakebank_twisted src/bank-lib/test_bank_api_with_pybank_twisted src/lib/test_exchange_api + +src/lib/test_taler_exchange_httpd_home/.local/share/taler/exchange/live-keys/ +src/lib/test_taler_exchange_httpd_home/.local/share/taler/exchange/wirefees/ +src/lib/test_taler_exchange_httpd_home/.local/share/taler/auditor/ +src/lib/test_taler_exchange_httpd_home/.local/share/taler/auditors/ + src/lib/test_exchange_api_keys_cherry_picking_home/.local/share/taler/exchange/live-keys/ src/lib/test_exchange_api_keys_cherry_picking_home/.local/share/taler/exchange/wirefees/ src/lib/test_exchange_api_keys_cherry_picking_home/.local/share/taler/auditor/ @@ -56,6 +62,7 @@ src/exchange/test_taler_exchange_aggregator-postgres src/exchange/test_taler_exchange_httpd_home/.local/share/taler/exchange/live-keys/ src/exchange/test_taler_exchange_httpd_home/.local/share/taler/exchange/wirefees/ src/exchange-tools/taler-auditor-sign +src/exchange-tools/taler-exchange-tvg src/exchange-tools/taler-exchange-dbinit src/exchange-tools/taler-exchange-keycheck src/exchange-tools/taler-exchange-keyup diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index 277237ed8..3351609c9 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -271,6 +271,7 @@ test_taler_exchange_wirewatch_postgres_LDADD = \ $(top_builddir)/src/bank-lib/libtalerfakebank.la \ $(top_builddir)/src/json/libtalerjson.la \ $(top_builddir)/src/util/libtalerutil.la \ + $(top_builddir)/src/lib/libtalertesting.la \ -lmicrohttpd \ -lgnunetutil \ -lgnunetjson \ diff --git a/src/lib/test-taler-exchange-wirewatch-postgres.conf b/src/lib/test-taler-exchange-wirewatch-postgres.conf index 7f8cc4793..645a0a1bf 100644 --- a/src/lib/test-taler-exchange-wirewatch-postgres.conf +++ b/src/lib/test-taler-exchange-wirewatch-postgres.conf @@ -17,7 +17,7 @@ PORT = 8081 MASTER_PUBLIC_KEY = 98NJW3CQHZQGQXTY3K85K531XKPAPAVV4Q5V8PYYRR00NJGZWNVG # Expected base URL of the exchange. -BASE_URL = "https://exchange.taler.net/" +BASE_URL = "http://localhost:8081/" [exchangedb] # After how long do we close idle reserves? The exchange @@ -31,15 +31,24 @@ BASE_URL = "https://exchange.taler.net/" IDLE_RESERVE_EXPIRATION_TIME = 5 s [exchangedb-postgres] - #The connection string the plugin has to use for connecting to the database -CONFIG = postgres:///talercheck +CONFIG = "postgres:///talercheck" + +[auditordb-postgres] +CONFIG = "postgres:///talercheck" + +[auditor] +BASE_URL = "http://localhost:8083/" + +# HTTP port the auditor listens to +PORT = 8083 [account-1] # 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 @@ -71,3 +80,18 @@ CLOSING-FEE-2024 = EUR:0.01 CLOSING-FEE-2025 = EUR:0.01 CLOSING-FEE-2026 = EUR:0.01 CLOSING-FEE-2027 = EUR:0.01 + +# Need at least one coin, otherwise Exchange +# refuses to start. +[coin_eur_ct_1] +value = EUR:0.01 +duration_overlap = 5 minutes +duration_withdraw = 7 days +duration_spend = 2 years +duration_legal = 3 years +fee_withdraw = EUR:0.00 +fee_deposit = EUR:0.00 +fee_refresh = EUR:0.01 +fee_refund = EUR:0.01 +rsa_keysize = 1024 + diff --git a/src/lib/test_taler_exchange_httpd_home/.config/taler/account-1.json b/src/lib/test_taler_exchange_httpd_home/.config/taler/account-1.json new file mode 100644 index 000000000..463ea2560 --- /dev/null +++ b/src/lib/test_taler_exchange_httpd_home/.config/taler/account-1.json @@ -0,0 +1,4 @@ +{ + "url": "payto://x-taler-bank/localhost:8082/3", + "master_sig": "P0EC2BBQ8HYCMR29651K7Y36MVQMDP2746EHTAGXYKNVXRZR604BGDSGZ99NPM26BJJFAR16MGW2QJD15BXYPJWNPY2WVACHTW0XE2R" +}
\ No newline at end of file diff --git a/src/lib/test_taler_exchange_httpd_home/.local/share/taler/exchange/offline-keys/master.priv b/src/lib/test_taler_exchange_httpd_home/.local/share/taler/exchange/offline-keys/master.priv new file mode 100644 index 000000000..394926938 --- /dev/null +++ b/src/lib/test_taler_exchange_httpd_home/.local/share/taler/exchange/offline-keys/master.priv @@ -0,0 +1 @@ +p^-33XX!\0qmU_
\ No newline at end of file diff --git a/src/lib/test_taler_exchange_wirewatch.c b/src/lib/test_taler_exchange_wirewatch.c index 9c089a54d..6aea21613 100644 --- a/src/lib/test_taler_exchange_wirewatch.c +++ b/src/lib/test_taler_exchange_wirewatch.c @@ -30,9 +30,23 @@ #include "taler_json_lib.h" #include <microhttpd.h> #include "taler_fakebank_lib.h" +#include "taler_testing_lib.h" /** + * Bank configuration data. + */ +static struct TALER_TESTING_BankConfiguration bc; + +/** + * Helper structure to keep exchange configuration values. + */ +struct TALER_TESTING_ExchangeConfiguration ec; + +// just to compile +int result; + +/** * Commands for the interpreter. */ enum OpCode @@ -237,11 +251,6 @@ static struct GNUNET_DISK_PipeHandle *sigpipe; static struct GNUNET_SCHEDULER_Task *timeout_task; /** - * Return value from main(). - */ -static int result; - -/** * Name of the configuration file to use. */ static char *config_filename; @@ -256,7 +265,6 @@ static struct GNUNET_SCHEDULER_Task *int_task; */ static struct TALER_FAKEBANK_Handle *fb; - /** * Interprets the commands from the test program. * @@ -460,6 +468,7 @@ interpreter (void *cls) "Running command %u (%s)\n", state->ioff, cmd->label); +#if 0 switch (cmd->opcode) { case OPCODE_TERMINATE_SKIP: @@ -588,6 +597,29 @@ interpreter (void *cls) GNUNET_SCHEDULER_shutdown (); return; } +#endif +} + +/** + * Main function that will tell the interpreter what commands to + * run. + * + * @param cls closure + */ +static void +run (void *cls, + struct TALER_TESTING_Interpreter *is) +{ + struct TALER_TESTING_Command all[] = { + // TALER_TESTING_cmd_exec_aggregator ("expect-empty-transactions-on-start", + // config_filename), + TALER_TESTING_cmd_end () + }; + + TALER_TESTING_run_with_fakebank (is, + all, + bc.bank_url); + } @@ -597,9 +629,11 @@ interpreter (void *cls) * @param cls closure with configuration */ static void -run (void *cls) +OLDrun (void *cls) { static struct Command commands[] = { + #if 0 + /* test running with empty DB */ { .opcode = OPCODE_EXPECT_TRANSFERS_EMPTY, @@ -720,7 +754,9 @@ run (void *cls) .opcode = OPCODE_TERMINATE_SUCCESS, .label = "testcase-complete-terminating-with-success" } + #endif }; + static struct State state = { .commands = commands }; @@ -773,7 +809,13 @@ main (int argc, struct GNUNET_CONFIGURATION_Handle *cfg; struct GNUNET_SIGNAL_Context *shc_chld; - result = -1; + /* these might get in the way */ + unsetenv ("XDG_DATA_HOME"); + unsetenv ("XDG_CONFIG_HOME"); + GNUNET_log_setup ("test_taler_exchange_wirewatch", + "WARNING", + NULL); + if (NULL == (plugin_name = strrchr (argv[0], (int) '-'))) { GNUNET_break (0); @@ -786,12 +828,7 @@ main (int argc, (void) GNUNET_asprintf (&config_filename, "%s.conf", testname); - /* these might get in the way */ - unsetenv ("XDG_DATA_HOME"); - unsetenv ("XDG_CONFIG_HOME"); - GNUNET_log_setup ("test_taler_exchange_wirewatch", - "WARNING", - NULL); + /* check database is working */ { struct GNUNET_PQ_Context *conn; @@ -806,71 +843,24 @@ main (int argc, return 77; GNUNET_PQ_disconnect (conn); } - proc = GNUNET_OS_start_process (GNUNET_NO, - GNUNET_OS_INHERIT_STD_ALL, - NULL, NULL, NULL, - "taler-exchange-keyup", - "taler-exchange-keyup", - "-c", config_filename, - NULL); - if (NULL == proc) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Failed to run `taler-exchange-keyup`, is your PATH correct?\n"); - return 77; - } - GNUNET_OS_process_wait (proc); - GNUNET_OS_process_destroy (proc); - proc = GNUNET_OS_start_process (GNUNET_NO, - GNUNET_OS_INHERIT_STD_ALL, - NULL, NULL, NULL, - "taler-exchange-dbinit", - "taler-exchange-dbinit", - "-c", config_filename, - "-r", - NULL); - if (NULL == proc) + + TALER_TESTING_cleanup_files (config_filename); + if (GNUNET_OK != TALER_TESTING_prepare_exchange (config_filename, + &ec)) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Failed to run `taler-exchange-keyup`, is your PATH correct?\n"); + TALER_LOG_INFO ("Could not prepare the exchange\n"); return 77; } - GNUNET_OS_process_wait (proc); - GNUNET_OS_process_destroy (proc); + if (GNUNET_OK != - GNUNET_NETWORK_test_port_free (IPPROTO_TCP, - 8082)) - { - fprintf (stderr, - "Required port %u not available, skipping.\n", - (unsigned int) 8082); + TALER_TESTING_prepare_fakebank (config_filename, + "account-1", + &bc)) return 77; - } - cfg = GNUNET_CONFIGURATION_create (); - if (GNUNET_OK != - GNUNET_CONFIGURATION_parse (cfg, - config_filename)) - { - GNUNET_break (0); - GNUNET_free (config_filename); - GNUNET_free (testname); - return 2; - } - sigpipe = GNUNET_DISK_pipe (GNUNET_NO, GNUNET_NO, - GNUNET_NO, GNUNET_NO); - GNUNET_assert (NULL != sigpipe); - shc_chld = - GNUNET_SIGNAL_handler_install (GNUNET_SIGCHLD, - &sighandler_child_death); - GNUNET_SCHEDULER_run (&run, - cfg); - GNUNET_SIGNAL_handler_uninstall (shc_chld); - GNUNET_DISK_pipe_close (sigpipe); - GNUNET_CONFIGURATION_destroy (cfg); - GNUNET_free (config_filename); - GNUNET_free (testname); - return result; -} + return TALER_TESTING_setup_with_exchange (&run, + NULL, + config_filename); +} /* end of test_taler_exchange_wirewatch.c */ |