Test cases.
Only check if PORT is available if exchange serves via http. Also get the base URL from the config -- fixes those situations where it is not possible to construct it as localhost:<port>.
This commit is contained in:
parent
7d2fbc4796
commit
a761baab49
@ -355,15 +355,33 @@ TALER_TESTING_setup_with_exchange (TALER_TESTING_Main main_cb,
|
|||||||
int result;
|
int result;
|
||||||
unsigned int iter;
|
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 *wget_cmd;
|
||||||
|
char *base_url;
|
||||||
|
|
||||||
cfg = GNUNET_CONFIGURATION_create ();
|
cfg = GNUNET_CONFIGURATION_create ();
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
GNUNET_CONFIGURATION_load (cfg,
|
GNUNET_CONFIGURATION_load (cfg,
|
||||||
config_filename))
|
config_filename))
|
||||||
return GNUNET_NO;
|
return GNUNET_NO;
|
||||||
|
|
||||||
|
if (GNUNET_OK !=
|
||||||
|
GNUNET_CONFIGURATION_get_value_string (cfg,
|
||||||
|
"exchange",
|
||||||
|
"SERVE",
|
||||||
|
&serve))
|
||||||
|
{
|
||||||
|
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
|
||||||
|
"exchange",
|
||||||
|
"SERVE");
|
||||||
|
GNUNET_CONFIGURATION_destroy (cfg);
|
||||||
|
return GNUNET_NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0 == strcmp ("http", serve))
|
||||||
|
{
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
GNUNET_CONFIGURATION_get_value_number (cfg,
|
GNUNET_CONFIGURATION_get_value_number (cfg,
|
||||||
"exchange",
|
"exchange",
|
||||||
@ -387,7 +405,7 @@ TALER_TESTING_setup_with_exchange (TALER_TESTING_Main main_cb,
|
|||||||
port);
|
port);
|
||||||
return GNUNET_NO;
|
return GNUNET_NO;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
exchanged = GNUNET_OS_start_process (GNUNET_NO,
|
exchanged = GNUNET_OS_start_process (GNUNET_NO,
|
||||||
GNUNET_OS_INHERIT_STD_ALL,
|
GNUNET_OS_INHERIT_STD_ALL,
|
||||||
NULL, NULL, NULL,
|
NULL, NULL, NULL,
|
||||||
@ -396,6 +414,25 @@ TALER_TESTING_setup_with_exchange (TALER_TESTING_Main main_cb,
|
|||||||
"-c", config_filename,
|
"-c", config_filename,
|
||||||
"-i",
|
"-i",
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
if (GNUNET_OK !=
|
||||||
|
GNUNET_CONFIGURATION_get_value_string (cfg,
|
||||||
|
"exchange",
|
||||||
|
"BASE_URL",
|
||||||
|
&base_url))
|
||||||
|
{
|
||||||
|
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
|
||||||
|
"exchange",
|
||||||
|
"BASE_URL");
|
||||||
|
GNUNET_CONFIGURATION_destroy (cfg);
|
||||||
|
return GNUNET_NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 */
|
/* give child time to start and bind against the socket */
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
"Waiting for `taler-exchange-httpd' to be ready\n");
|
"Waiting for `taler-exchange-httpd' to be ready\n");
|
||||||
@ -417,9 +454,7 @@ TALER_TESTING_setup_with_exchange (TALER_TESTING_Main main_cb,
|
|||||||
sleep (1);
|
sleep (1);
|
||||||
iter++;
|
iter++;
|
||||||
}
|
}
|
||||||
while (0 != system
|
while (0 != system (wget_cmd));
|
||||||
("wget -q -t 1 -T 1 http://127.0.0.1:8081/keys"
|
|
||||||
" -o /dev/null -O /dev/null"));
|
|
||||||
|
|
||||||
result = TALER_TESTING_setup (main_cb,
|
result = TALER_TESTING_setup (main_cb,
|
||||||
main_cb_cls,
|
main_cb_cls,
|
||||||
|
Loading…
Reference in New Issue
Block a user