in parallel tests, only launch one exchange -- still broken: code attempts to launch multiple fakebanks
This commit is contained in:
parent
4693708b8c
commit
f17ad4de76
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"url": "payto://x-taler-bank/localhost:8082/2",
|
"url": "payto://x-taler-bank/localhost:8082/2",
|
||||||
"salt": "V7S6Y75HPSFGKXET03NHS3SDEST5Q0XNX9WYCXRRRNRHPBVSD86Y1A7ZR5KR7105JN3XDBTKWDD3WQZ9XA2MJKD020APECA0P61FFBG",
|
"salt": "NYZ2WR8CPT5PB58X10EZDJDY3MSWHAHTD0M99JJH54Z0A916NTX4P4AF5Y3KPGRYEVX3TV7J2ZG6PKZSKFYMSKMHCN83ZT3V2216YP8",
|
||||||
"master_sig": "H61WAQKG8F9W25SZNVF1JPNYG0BFYXPN65D936TT44ZC0JT849R8YNC0CFPJBQX77EW51DCR0864DC82A4J2AF7H55DSVVMWVYEZR1R"
|
"master_sig": "0RF7GBGKGJQ0ZQVP0HJ516CC882RV6HVJZABN5S1YMF6WD94QJJRZSTFB669QTNW63DPRP0YYJ0RGCNXA3AHQ1HGYDGAMZX0S983020"
|
||||||
}
|
}
|
@ -327,7 +327,6 @@ run (void *cls,
|
|||||||
struct TALER_Amount total_reserve_amount;
|
struct TALER_Amount total_reserve_amount;
|
||||||
struct TALER_Amount withdraw_fee;
|
struct TALER_Amount withdraw_fee;
|
||||||
char *withdraw_fee_str;
|
char *withdraw_fee_str;
|
||||||
|
|
||||||
struct TALER_TESTING_Command all_commands
|
struct TALER_TESTING_Command all_commands
|
||||||
[1 + /* Withdraw block */
|
[1 + /* Withdraw block */
|
||||||
howmany_coins + /* All units */
|
howmany_coins + /* All units */
|
||||||
@ -353,19 +352,14 @@ run (void *cls,
|
|||||||
TALER_amount_add (&total_reserve_amount,
|
TALER_amount_add (&total_reserve_amount,
|
||||||
&total_reserve_amount,
|
&total_reserve_amount,
|
||||||
&withdraw_fee);
|
&withdraw_fee);
|
||||||
|
|
||||||
struct TALER_TESTING_Command make_reserve[] = {
|
struct TALER_TESTING_Command make_reserve[] = {
|
||||||
|
|
||||||
CMD_TRANSFER_TO_EXCHANGE
|
CMD_TRANSFER_TO_EXCHANGE
|
||||||
("create-reserve",
|
("create-reserve",
|
||||||
TALER_amount_to_string (&total_reserve_amount)),
|
TALER_amount_to_string (&total_reserve_amount)),
|
||||||
|
|
||||||
TALER_TESTING_cmd_exec_wirewatch
|
TALER_TESTING_cmd_exec_wirewatch
|
||||||
("wirewatch",
|
("wirewatch",
|
||||||
cfg_filename),
|
cfg_filename),
|
||||||
|
|
||||||
TALER_TESTING_cmd_end ()
|
TALER_TESTING_cmd_end ()
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
all_commands[0] = TALER_TESTING_cmd_batch ("make-reserve",
|
all_commands[0] = TALER_TESTING_cmd_batch ("make-reserve",
|
||||||
@ -379,18 +373,15 @@ run (void *cls,
|
|||||||
GNUNET_asprintf (&withdraw_label,
|
GNUNET_asprintf (&withdraw_label,
|
||||||
"withdraw-%u",
|
"withdraw-%u",
|
||||||
i);
|
i);
|
||||||
|
|
||||||
GNUNET_asprintf (&order_enc,
|
GNUNET_asprintf (&order_enc,
|
||||||
"{\"nonce\": %u}",
|
"{\"nonce\": %u}",
|
||||||
i);
|
i);
|
||||||
|
|
||||||
unit[0] = TALER_TESTING_cmd_withdraw_amount
|
unit[0] = TALER_TESTING_cmd_withdraw_amount
|
||||||
(withdraw_label,
|
(withdraw_label,
|
||||||
is->exchange,
|
is->exchange,
|
||||||
"create-reserve",
|
"create-reserve",
|
||||||
AMOUNT_5,
|
AMOUNT_5,
|
||||||
MHD_HTTP_OK);
|
MHD_HTTP_OK);
|
||||||
|
|
||||||
unit[1] = TALER_TESTING_cmd_deposit
|
unit[1] = TALER_TESTING_cmd_deposit
|
||||||
("deposit",
|
("deposit",
|
||||||
is->exchange,
|
is->exchange,
|
||||||
@ -424,22 +415,20 @@ run (void *cls,
|
|||||||
AMOUNT_4,
|
AMOUNT_4,
|
||||||
withdraw_label,
|
withdraw_label,
|
||||||
MHD_HTTP_OK);
|
MHD_HTTP_OK);
|
||||||
|
|
||||||
unit[3] = TALER_TESTING_cmd_refresh_reveal
|
unit[3] = TALER_TESTING_cmd_refresh_reveal
|
||||||
(reveal_label,
|
(reveal_label,
|
||||||
is->exchange,
|
is->exchange,
|
||||||
melt_label,
|
melt_label,
|
||||||
MHD_HTTP_OK);
|
MHD_HTTP_OK);
|
||||||
|
|
||||||
unit[4] = TALER_TESTING_cmd_refresh_link
|
unit[4] = TALER_TESTING_cmd_refresh_link
|
||||||
("refresh-link",
|
("refresh-link",
|
||||||
is->exchange,
|
is->exchange,
|
||||||
reveal_label,
|
reveal_label,
|
||||||
MHD_HTTP_OK);
|
MHD_HTTP_OK);
|
||||||
|
|
||||||
unit[5] = TALER_TESTING_cmd_end ();
|
unit[5] = TALER_TESTING_cmd_end ();
|
||||||
}
|
}
|
||||||
else unit[2] = TALER_TESTING_cmd_end ();
|
else
|
||||||
|
unit[2] = TALER_TESTING_cmd_end ();
|
||||||
|
|
||||||
all_commands[1 + i] = TALER_TESTING_cmd_batch ("unit",
|
all_commands[1 + i] = TALER_TESTING_cmd_batch ("unit",
|
||||||
unit);
|
unit);
|
||||||
@ -473,17 +462,37 @@ parallel_benchmark (TALER_TESTING_Main main_cb,
|
|||||||
int result;
|
int result;
|
||||||
pid_t cpids[howmany_clients];
|
pid_t cpids[howmany_clients];
|
||||||
int wstatus;
|
int wstatus;
|
||||||
|
struct GNUNET_OS_Process *exchanged;
|
||||||
|
|
||||||
|
exchanged = GNUNET_OS_start_process (GNUNET_NO,
|
||||||
|
GNUNET_OS_INHERIT_STD_ALL,
|
||||||
|
NULL, NULL, NULL,
|
||||||
|
"taler-exchange-httpd",
|
||||||
|
"taler-exchange-httpd",
|
||||||
|
"-c", config_file,
|
||||||
|
"-i",
|
||||||
|
NULL);
|
||||||
|
if (NULL == exchanged)
|
||||||
|
return GNUNET_SYSERR;
|
||||||
|
if (0 != TALER_TESTING_wait_exchange_ready (exchange_url))
|
||||||
|
{
|
||||||
|
GNUNET_OS_process_kill (exchanged,
|
||||||
|
SIGTERM);
|
||||||
|
GNUNET_OS_process_wait (exchanged);
|
||||||
|
GNUNET_OS_process_destroy (exchanged);
|
||||||
|
return 77;
|
||||||
|
}
|
||||||
result = GNUNET_OK;
|
result = GNUNET_OK;
|
||||||
for (unsigned int i=0;i<howmany_clients;i++)
|
for (unsigned int i=0;i<howmany_clients;i++)
|
||||||
{
|
{
|
||||||
if (0 == (cpids[i] = fork ()))
|
if (0 == (cpids[i] = fork ()))
|
||||||
{
|
{
|
||||||
/* I am the child, do the work! */
|
/* I am the child, do the work! */
|
||||||
result = TALER_TESTING_setup_with_exchange
|
result = TALER_TESTING_setup
|
||||||
(run,
|
(run,
|
||||||
NULL,
|
NULL,
|
||||||
cfg_filename);
|
cfg_filename,
|
||||||
|
exchanged);
|
||||||
if (GNUNET_OK == result)
|
if (GNUNET_OK == result)
|
||||||
exit (0);
|
exit (0);
|
||||||
else
|
else
|
||||||
@ -509,6 +518,12 @@ parallel_benchmark (TALER_TESTING_Main main_cb,
|
|||||||
(0 != WEXITSTATUS (wstatus)) )
|
(0 != WEXITSTATUS (wstatus)) )
|
||||||
result = GNUNET_SYSERR;
|
result = GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
|
GNUNET_break (0 ==
|
||||||
|
GNUNET_OS_process_kill (exchanged,
|
||||||
|
SIGTERM));
|
||||||
|
GNUNET_break (GNUNET_OK ==
|
||||||
|
GNUNET_OS_process_wait (exchanged));
|
||||||
|
GNUNET_OS_process_destroy (exchanged);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -337,6 +337,47 @@ TALER_TESTING_find_pk (const struct TALER_EXCHANGE_Keys *keys,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wait for the exchange to have started. Waits for at
|
||||||
|
* most 10s, after that returns 77 to indicate an error.
|
||||||
|
*
|
||||||
|
* @param base_url what URL should we expect the exchange
|
||||||
|
* to be running at
|
||||||
|
* @return 0 on success
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
TALER_TESTING_wait_exchange_ready (const char *base_url)
|
||||||
|
{
|
||||||
|
char *wget_cmd;
|
||||||
|
unsigned int iter;
|
||||||
|
|
||||||
|
GNUNET_asprintf (&wget_cmd,
|
||||||
|
"wget -q -t 1 -T 1 %skeys"
|
||||||
|
" -o /dev/null -O /dev/null",
|
||||||
|
base_url); // make sure ends with '/'
|
||||||
|
/* give child time to start and bind against the socket */
|
||||||
|
fprintf (stderr,
|
||||||
|
"Waiting for `taler-exchange-httpd' to be ready\n");
|
||||||
|
iter = 0;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if (10 == iter)
|
||||||
|
{
|
||||||
|
fprintf (stderr,
|
||||||
|
"Failed to launch `taler-exchange-httpd' (or `wget')\n");
|
||||||
|
GNUNET_free (wget_cmd);
|
||||||
|
return 77;
|
||||||
|
}
|
||||||
|
fprintf (stderr, ".\n");
|
||||||
|
sleep (1);
|
||||||
|
iter++;
|
||||||
|
}
|
||||||
|
while (0 != system (wget_cmd));
|
||||||
|
GNUNET_free (wget_cmd);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize scheduler loop and curl context for the testcase
|
* Initialize scheduler loop and curl context for the testcase
|
||||||
* including starting and stopping the exchange using the given
|
* including starting and stopping the exchange using the given
|
||||||
@ -356,12 +397,10 @@ TALER_TESTING_setup_with_exchange (TALER_TESTING_Main main_cb,
|
|||||||
const char *config_filename)
|
const char *config_filename)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
unsigned int iter;
|
|
||||||
struct GNUNET_OS_Process *exchanged;
|
struct GNUNET_OS_Process *exchanged;
|
||||||
struct GNUNET_CONFIGURATION_Handle *cfg;
|
struct GNUNET_CONFIGURATION_Handle *cfg;
|
||||||
unsigned long long port;
|
unsigned long long port;
|
||||||
char *serve;
|
char *serve;
|
||||||
char *wget_cmd;
|
|
||||||
char *base_url;
|
char *base_url;
|
||||||
|
|
||||||
cfg = GNUNET_CONFIGURATION_create ();
|
cfg = GNUNET_CONFIGURATION_create ();
|
||||||
@ -431,33 +470,8 @@ TALER_TESTING_setup_with_exchange (TALER_TESTING_Main main_cb,
|
|||||||
}
|
}
|
||||||
GNUNET_CONFIGURATION_destroy (cfg);
|
GNUNET_CONFIGURATION_destroy (cfg);
|
||||||
|
|
||||||
GNUNET_asprintf (&wget_cmd,
|
if (0 != TALER_TESTING_wait_exchange_ready (base_url))
|
||||||
"wget -q -t 1 -T 1 %skeys"
|
|
||||||
" -o /dev/null -O /dev/null",
|
|
||||||
base_url); // make sure ends with '/'
|
|
||||||
|
|
||||||
/* give child time to start and bind against the socket */
|
|
||||||
fprintf (stderr,
|
|
||||||
"Waiting for `taler-exchange-httpd' to be ready\n");
|
|
||||||
iter = 0;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
if (10 == iter)
|
|
||||||
{
|
|
||||||
fprintf (stderr,
|
|
||||||
"Failed to launch `taler-exchange-httpd'"
|
|
||||||
" (or `wget')\n");
|
|
||||||
GNUNET_OS_process_kill (exchanged,
|
|
||||||
SIGTERM);
|
|
||||||
GNUNET_OS_process_wait (exchanged);
|
|
||||||
GNUNET_OS_process_destroy (exchanged);
|
|
||||||
return 77;
|
return 77;
|
||||||
}
|
|
||||||
fprintf (stderr, ".\n");
|
|
||||||
sleep (1);
|
|
||||||
iter++;
|
|
||||||
}
|
|
||||||
while (0 != system (wget_cmd));
|
|
||||||
|
|
||||||
/* NOTE: this blocks. */
|
/* NOTE: this blocks. */
|
||||||
result = TALER_TESTING_setup (main_cb,
|
result = TALER_TESTING_setup (main_cb,
|
||||||
|
@ -520,7 +520,7 @@ sighandler_child_death ()
|
|||||||
* @param keys the exchange's keys.
|
* @param keys the exchange's keys.
|
||||||
* @param compat protocol compatibility information.
|
* @param compat protocol compatibility information.
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
cert_cb (void *cls,
|
cert_cb (void *cls,
|
||||||
const struct TALER_EXCHANGE_Keys *keys,
|
const struct TALER_EXCHANGE_Keys *keys,
|
||||||
enum TALER_EXCHANGE_VersionCompatibility compat)
|
enum TALER_EXCHANGE_VersionCompatibility compat)
|
||||||
@ -562,6 +562,7 @@ cert_cb (void *cls,
|
|||||||
main_ctx->is);
|
main_ctx->is);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize scheduler loop and curl context for the testcase,
|
* Initialize scheduler loop and curl context for the testcase,
|
||||||
* and responsible to run the "run" method.
|
* and responsible to run the "run" method.
|
||||||
|
@ -113,6 +113,18 @@ TALER_TESTING_prepare_exchange (const char *config_filename,
|
|||||||
char **base_url);
|
char **base_url);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wait for the exchange to have started. Waits for at
|
||||||
|
* most 10s, after that returns 77 to indicate an error.
|
||||||
|
*
|
||||||
|
* @param base_url what URL should we expect the exchange
|
||||||
|
* to be running at
|
||||||
|
* @return 0 on success
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
TALER_TESTING_wait_exchange_ready (const char *base_url);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove files from previous runs
|
* Remove files from previous runs
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user