fix benchmark

This commit is contained in:
Christian Grothoff 2020-01-19 15:36:43 +01:00
parent 72a629a8be
commit fdd8d602ba
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
2 changed files with 43 additions and 57 deletions

View File

@ -37,18 +37,24 @@ config = "postgres:///talercheck"
[benchmark-remote-exchange] [benchmark-remote-exchange]
host = localhost host = localhost
dir = /home/dold/repos/taler/exchange/src/benchmark # Adjust $HOME to match remote target!
dir = $HOME/repos/taler/exchange/src/benchmark
[benchmark]
USER_PAYTO_URI = payto://x-taler-bank/localhost:8082/42
[account-2] [account-2]
# What is the bank account (with the "Taler Bank" demo system)? # What is the payto://-URL of the exchange (to generate wire response)
URL = "payto://x-taler-bank/localhost:8082/2" URL = "payto://x-taler-bank/localhost:8082/2"
# What is the bank account (with the "Taler Bank" demo system)? Must end with "/".
WIRE_GATEWAY_URL = http://localhost:8082/2/
# This is the response we give out for the /wire request. It provides # This is the response we give out for the /wire request. It provides
# wallets with the bank information for transfers to the exchange. # wallets with the bank information for transfers to the exchange.
wire_response = ${TALER_CONFIG_HOME}/account-2.json WIRE_RESPONSE = ${TALER_CONFIG_HOME}/account-2.json
# Which wire plugin should we use to access the account? # Which wire method should we use to calculate fees?
METHOD = x-taler-bank METHOD = x-taler-bank
# Authentication information for basic authentication # Authentication information for basic authentication
taler_bank_auth_method = "basic" WIRE_GATEWAY_AUTH_METHOD = "basic"
username = user username = user
password = pass password = pass

View File

@ -155,11 +155,6 @@ static enum BenchmarkMode mode;
*/ */
static char *cfg_filename; static char *cfg_filename;
/**
* payto://-URL of the exchange's bank account.
*/
static char *exchange_payto_url;
/** /**
* Currency used. * Currency used.
*/ */
@ -186,7 +181,8 @@ static struct TALER_TESTING_Command
CMD_TRANSFER_TO_EXCHANGE (char *label, char *amount) CMD_TRANSFER_TO_EXCHANGE (char *label, char *amount)
{ {
return TALER_TESTING_cmd_admin_add_incoming_retry return TALER_TESTING_cmd_admin_add_incoming_retry
(TALER_TESTING_cmd_admin_add_incoming (label, amount, (TALER_TESTING_cmd_admin_add_incoming (label,
amount,
&exchange_bank_account, &exchange_bank_account,
user_payto_url)); user_payto_url));
} }
@ -322,7 +318,7 @@ run (void *cls,
("deposit", ("deposit",
withdraw_label, withdraw_label,
0, /* Index of the one withdrawn coin in the traits. */ 0, /* Index of the one withdrawn coin in the traits. */
exchange_payto_url, user_payto_url,
order_enc, order_enc,
GNUNET_TIME_UNIT_ZERO, GNUNET_TIME_UNIT_ZERO,
AMOUNT_1, AMOUNT_1,
@ -400,27 +396,16 @@ stop_fakebank (void *cls)
/** /**
* Start the fakebank. * Start the fakebank.
* *
* @param cls the URL of the fakebank * @param cls NULL
*/ */
static void static void
launch_fakebank (void *cls) launch_fakebank (void *cls)
{ {
const char *hostname = cls;
const char *port;
long pnum;
struct TALER_FAKEBANK_Handle *fakebank; struct TALER_FAKEBANK_Handle *fakebank;
port = strrchr (hostname, (void) cls;
(unsigned char) ':'); fakebank
if (NULL == port) = TALER_TESTING_run_fakebank (exchange_bank_account.wire_gateway_url);
pnum = 80;
else
pnum = strtol (port + 1, NULL, 10);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Starting Fakebank on port %u (%s)\n",
(unsigned int) pnum,
hostname);
fakebank = TALER_FAKEBANK_start ((uint16_t) pnum);
if (NULL == fakebank) if (NULL == fakebank)
{ {
GNUNET_break (0); GNUNET_break (0);
@ -464,7 +449,7 @@ parallel_benchmark (TALER_TESTING_Main main_cb,
NULL == loglev ? "INFO" : loglev, NULL == loglev ? "INFO" : loglev,
logfile); logfile);
GNUNET_SCHEDULER_run (&launch_fakebank, GNUNET_SCHEDULER_run (&launch_fakebank,
exchange_bank_account.wire_gateway_url); NULL);
exit (0); exit (0);
} }
if (-1 == fakebank) if (-1 == fakebank)
@ -642,8 +627,9 @@ parallel_benchmark (TALER_TESTING_Main main_cb,
if (MODE_EXCHANGE == mode) if (MODE_EXCHANGE == mode)
(void) getchar (); (void) getchar ();
if ( (GNUNET_YES == linger) && ( ((mode == MODE_BOTH) || (mode == if ( (GNUNET_YES == linger) &&
MODE_CLIENT) ) ) ) ( ((mode == MODE_BOTH) ||
(mode == MODE_CLIENT) ) ) )
{ {
printf ("press ENTER to stop\n"); printf ("press ENTER to stop\n");
(void) getchar (); (void) getchar ();
@ -823,17 +809,15 @@ main (int argc,
TALER_LOG_ERROR ("-p option value must not be zero\n"); TALER_LOG_ERROR ("-p option value must not be zero\n");
return BAD_CLI_ARG; return BAD_CLI_ARG;
} }
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_string GNUNET_CONFIGURATION_get_value_string (cfg,
(cfg,
"benchmark", "benchmark",
"user-url", "USER_PAYTO_URI",
&user_payto_url)) &user_payto_url))
{ {
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
"benchmark", "benchmark",
"user-url"); "USER_PAYTO_URI");
return BAD_CONFIG_FILE; return BAD_CONFIG_FILE;
} }
@ -846,20 +830,17 @@ main (int argc,
if (NULL == bank_details_section) if (NULL == bank_details_section)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_ ( "Missing specification of bank account in configuration\n");
"Missing specification of bank account in configuration\n"));
return BAD_CONFIG_FILE; return BAD_CONFIG_FILE;
} }
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_string TALER_BANK_auth_parse_cfg (cfg,
(cfg,
bank_details_section, bank_details_section,
"url", &exchange_bank_account))
&exchange_payto_url))
{ {
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
bank_details_section, "Configuration fails to provide exchange bank details in section `%s'\n",
"url"); bank_details_section);
return BAD_CONFIG_FILE; return BAD_CONFIG_FILE;
} }
} }
@ -867,8 +848,8 @@ main (int argc,
{ {
struct GNUNET_OS_Process *compute_wire_response; struct GNUNET_OS_Process *compute_wire_response;
compute_wire_response = GNUNET_OS_start_process compute_wire_response
(GNUNET_NO, = GNUNET_OS_start_process (GNUNET_NO,
GNUNET_OS_INHERIT_STD_ALL, GNUNET_OS_INHERIT_STD_ALL,
NULL, NULL, NULL, NULL, NULL, NULL,
"taler-exchange-wire", "taler-exchange-wire",
@ -878,8 +859,7 @@ main (int argc,
if (NULL == compute_wire_response) if (NULL == compute_wire_response)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to run `taler-exchange-wire`," "Failed to run `taler-exchange-wire`, is your PATH correct?\n");
" is your PATH correct?\n");
return GNUNET_NO; return GNUNET_NO;
} }
GNUNET_OS_process_wait (compute_wire_response); GNUNET_OS_process_wait (compute_wire_response);