From e0cf954ad9ab0c1613ab2c0f06ada581dbdb8276 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 23 Dec 2019 11:47:16 +0100 Subject: make exchange test suite work with current bank --- src/auditor/generate-auditor-basedb.sh | 2 +- src/bank-lib/bank_api_admin.c | 1 - src/bank-lib/test_bank_api.c | 32 ++++++++++++++++---------------- src/bank-lib/test_bank_api_twisted.c | 2 +- src/bank-lib/testing_api_helpers.c | 23 +++++++++++++---------- src/benchmark/taler-exchange-benchmark.c | 6 +++--- src/include/taler_testing_bank_lib.h | 20 +++++++++++--------- 7 files changed, 45 insertions(+), 41 deletions(-) (limited to 'src') diff --git a/src/auditor/generate-auditor-basedb.sh b/src/auditor/generate-auditor-basedb.sh index e08bd12eb..7e8724cbf 100755 --- a/src/auditor/generate-auditor-basedb.sh +++ b/src/auditor/generate-auditor-basedb.sh @@ -96,7 +96,7 @@ mv a2e.dat $ABD # Launch services echo "Launching services" -taler-bank-manage -c $CONF serve-http & +taler-bank-manage-testing $CONF $TARGET_DB serve-http & taler-exchange-httpd -c $CONF 2> taler-exchange-httpd.log & taler-merchant-httpd -c $CONF -L INFO 2> taler-merchant-httpd.log & taler-exchange-wirewatch -c $CONF 2> taler-exchange-wirewatch.log & diff --git a/src/bank-lib/bank_api_admin.c b/src/bank-lib/bank_api_admin.c index cff444fb9..5240a3724 100644 --- a/src/bank-lib/bank_api_admin.c +++ b/src/bank-lib/bank_api_admin.c @@ -23,7 +23,6 @@ #include "bank_api_common.h" #include /* just for HTTP status codes */ #include "taler_signatures.h" -// FIXME(dold): temporary hack #include "taler_curl_lib.h" diff --git a/src/bank-lib/test_bank_api.c b/src/bank-lib/test_bank_api.c index a7b6aef7e..d15984a9c 100644 --- a/src/bank-lib/test_bank_api.c +++ b/src/bank-lib/test_bank_api.c @@ -92,7 +92,7 @@ run (void *cls, struct TALER_TESTING_Command commands[] = { TALER_TESTING_cmd_bank_history ("history-0", bank_url, - BANK_ACCOUNT_NUMBER, + TALER_TESTING_BANK_ACCOUNT_NUMBER, TALER_BANK_DIRECTION_BOTH, GNUNET_YES, NULL, @@ -101,65 +101,65 @@ run (void *cls, * the parameters, although it was always set as '200 OK' */ TRANSFER ("debit-1", "KUDOS:5.01", - EXCHANGE_ACCOUNT_NUMBER, - BANK_ACCOUNT_NUMBER, + TALER_TESTING_EXCHANGE_ACCOUNT_NUMBER, + TALER_TESTING_BANK_ACCOUNT_NUMBER, "subject 1"), TALER_TESTING_cmd_bank_history ("history-1c", bank_url, - BANK_ACCOUNT_NUMBER, + TALER_TESTING_BANK_ACCOUNT_NUMBER, TALER_BANK_DIRECTION_CREDIT, GNUNET_YES, NULL, 5), TALER_TESTING_cmd_bank_history ("history-1d", bank_url, - BANK_ACCOUNT_NUMBER, + TALER_TESTING_BANK_ACCOUNT_NUMBER, TALER_BANK_DIRECTION_DEBIT, GNUNET_YES, NULL, 5), TRANSFER ("debit-2", "KUDOS:3.21", - EXCHANGE_ACCOUNT_NUMBER, - USER_ACCOUNT_NUMBER, + TALER_TESTING_EXCHANGE_ACCOUNT_NUMBER, + TALER_TESTING_USER_ACCOUNT_NUMBER, "subject 2"), TRANSFER ("credit-2", "KUDOS:3.22", - USER_ACCOUNT_NUMBER, - EXCHANGE_ACCOUNT_NUMBER, + TALER_TESTING_USER_ACCOUNT_NUMBER, + TALER_TESTING_EXCHANGE_ACCOUNT_NUMBER, "credit 2"), TALER_TESTING_cmd_bank_history ("history-2b", bank_url, - EXCHANGE_ACCOUNT_NUMBER, + TALER_TESTING_EXCHANGE_ACCOUNT_NUMBER, TALER_BANK_DIRECTION_BOTH, GNUNET_YES, NULL, 5), TALER_TESTING_cmd_bank_history ("history-2bi", bank_url, - EXCHANGE_ACCOUNT_NUMBER, + TALER_TESTING_EXCHANGE_ACCOUNT_NUMBER, TALER_BANK_DIRECTION_BOTH, GNUNET_YES, "debit-1", 5), TRANSFER ("credit-for-reject-1", "KUDOS:1.01", - BANK_ACCOUNT_NUMBER, - EXCHANGE_ACCOUNT_NUMBER, + TALER_TESTING_BANK_ACCOUNT_NUMBER, + TALER_TESTING_EXCHANGE_ACCOUNT_NUMBER, "subject 3"), TALER_TESTING_cmd_bank_reject ("reject-1", bank_url, "credit-for-reject-1"), TALER_TESTING_cmd_bank_history ("history-r1", bank_url, - BANK_ACCOUNT_NUMBER, + TALER_TESTING_BANK_ACCOUNT_NUMBER, TALER_BANK_DIRECTION_BOTH, GNUNET_YES, NULL, 5), TALER_TESTING_cmd_bank_history ("history-r1c", bank_url, - BANK_ACCOUNT_NUMBER, + TALER_TESTING_BANK_ACCOUNT_NUMBER, TALER_BANK_DIRECTION_BOTH | TALER_BANK_DIRECTION_CANCEL, GNUNET_YES, @@ -187,7 +187,7 @@ main (int argc, /* These environment variables get in the way... */ unsetenv ("XDG_DATA_HOME"); unsetenv ("XDG_CONFIG_HOME"); - GNUNET_log_setup ("test-bank-api-with-(fake)bank-new", + GNUNET_log_setup ("test-bank-api", "DEBUG", NULL); diff --git a/src/bank-lib/test_bank_api_twisted.c b/src/bank-lib/test_bank_api_twisted.c index 2d2483d49..b926f9655 100644 --- a/src/bank-lib/test_bank_api_twisted.c +++ b/src/bank-lib/test_bank_api_twisted.c @@ -93,7 +93,7 @@ run (void *cls, TWISTED_BANK_URL), TALER_TESTING_cmd_bank_history ("history-0", TWISTED_BANK_URL, - EXCHANGE_ACCOUNT_NUMBER, + TALER_TESTING_EXCHANGE_ACCOUNT_NUMBER, TALER_BANK_DIRECTION_BOTH, GNUNET_NO, NULL, diff --git a/src/bank-lib/testing_api_helpers.c b/src/bank-lib/testing_api_helpers.c index 2f5ea36f5..499129aeb 100644 --- a/src/bank-lib/testing_api_helpers.c +++ b/src/bank-lib/testing_api_helpers.c @@ -41,18 +41,18 @@ struct TALER_BANK_AuthenticationData AUTHS[] = { /* Bank credentials */ {.method = TALER_BANK_AUTH_BASIC, - .details.basic.username = BANK_USERNAME, - .details.basic.password = BANK_PASSWORD}, + .details.basic.username = TALER_TESTING_BANK_USERNAME, + .details.basic.password = TALER_TESTING_BANK_PASSWORD}, /* Exchange credentials */ {.method = TALER_BANK_AUTH_BASIC, - .details.basic.username = EXCHANGE_USERNAME, - .details.basic.password = EXCHANGE_PASSWORD }, + .details.basic.username = TALER_TESTING_EXCHANGE_USERNAME, + .details.basic.password = TALER_TESTING_EXCHANGE_PASSWORD }, /* User credentials */ {.method = TALER_BANK_AUTH_BASIC, - .details.basic.username = USER_USERNAME, - .details.basic.password = USER_PASSWORD } + .details.basic.username = TALER_TESTING_USER_USERNAME, + .details.basic.password = TALER_TESTING_USER_PASSWORD } }; @@ -193,10 +193,10 @@ TALER_TESTING_run_bank (const char *config_filename, (GNUNET_NO, GNUNET_OS_INHERIT_STD_ALL, NULL, NULL, NULL, - "taler-bank-manage", - "taler-bank-manage", - "-c", config_filename, - "--with-db", database, + "taler-bank-manage-testing", + "taler-bank-manage-testing", + config_filename, + database, serve_arg, NULL); GNUNET_free (database); if (NULL == bank_proc) @@ -243,6 +243,9 @@ TALER_TESTING_run_bank (const char *config_filename, * Prepare the bank execution. Check if the port is available * and reset database. * + * NOTE: resetting the database is now done by taler-bank-manage-testing + * and should be removed here (once it works...)! FIXME! + * * @param config_filename configuration file name. * * @return the base url, or NULL upon errors. Must be freed diff --git a/src/benchmark/taler-exchange-benchmark.c b/src/benchmark/taler-exchange-benchmark.c index da10762cf..31dbdf15a 100644 --- a/src/benchmark/taler-exchange-benchmark.c +++ b/src/benchmark/taler-exchange-benchmark.c @@ -63,7 +63,7 @@ enum BenchmarkError * the only requirement is that this number then matches the * number given when building payto URLs at deposit time. */ -#define USER_ACCOUNT_NUMBER 3 +#define TALER_TESTING_USER_ACCOUNT_NUMBER 3 #define FIRST_INSTRUCTION -1 @@ -72,7 +72,7 @@ enum BenchmarkError (TALER_TESTING_cmd_fakebank_transfer (label, amount, \ exchange_bank_account.details. \ x_taler_bank.bank_base_url, \ - USER_ACCOUNT_NUMBER, \ + TALER_TESTING_USER_ACCOUNT_NUMBER, \ exchange_bank_account.details. \ x_taler_bank.no, \ "dummy_user", \ @@ -321,7 +321,7 @@ run (void *cls, withdraw_label, 0, /* Index of the one withdrawn coin in the traits. */ TALER_TESTING_make_wire_details - (USER_ACCOUNT_NUMBER, + (TALER_TESTING_USER_ACCOUNT_NUMBER, exchange_bank_account.details.x_taler_bank.hostname), order_enc, GNUNET_TIME_UNIT_ZERO, diff --git a/src/include/taler_testing_bank_lib.h b/src/include/taler_testing_bank_lib.h index 6b407197f..350aca3b7 100644 --- a/src/include/taler_testing_bank_lib.h +++ b/src/include/taler_testing_bank_lib.h @@ -35,15 +35,17 @@ /* ******** Credentials to log in at the bank ******* */ -#define BANK_ACCOUNT_NUMBER 1 -#define BANK_USERNAME "Bank" -#define BANK_PASSWORD "x" -#define EXCHANGE_ACCOUNT_NUMBER 2 -#define EXCHANGE_USERNAME "Exchange" -#define EXCHANGE_PASSWORD "x" -#define USER_ACCOUNT_NUMBER 3 -#define USER_USERNAME "Tor" -#define USER_PASSWORD "x" +/* Note that the same passwords must be set in the script in + contrib/taler-bank-manage-testing for the tests to work! */ +#define TALER_TESTING_BANK_ACCOUNT_NUMBER 1 +#define TALER_TESTING_BANK_USERNAME "Bank" +#define TALER_TESTING_BANK_PASSWORD "x" +#define TALER_TESTING_EXCHANGE_ACCOUNT_NUMBER 2 +#define TALER_TESTING_EXCHANGE_USERNAME "Exchange" +#define TALER_TESTING_EXCHANGE_PASSWORD "x" +#define TALER_TESTING_USER_ACCOUNT_NUMBER 3 +#define TALER_TESTING_USER_USERNAME "Tor" +#define TALER_TESTING_USER_PASSWORD "x" /* ********************* Helper functions ********************* */ -- cgit v1.2.3