commit 323d84d4eb6228e036d96726b7715f9a024df682
parent 0bc6d5162438fc0b333c6b052337023f74268d3d
Author: Marcello Stanisci <stanisci.m@gmail.com>
Date: Fri, 4 May 2018 11:24:54 +0200
Explicit merchant URL.
Merchant launcher for tests now takes the merchant
URL among its parameters. This gives more flexibility,
as it is now possible to run a merchant which listens
on unix sockets.
Diffstat:
4 files changed, 10 insertions(+), 28 deletions(-)
diff --git a/src/include/taler_merchant_testing_lib.h b/src/include/taler_merchant_testing_lib.h
@@ -62,7 +62,8 @@ TALER_TESTING_prepare_merchant (const char *config_filename);
* be started.
*/
struct GNUNET_OS_Process *
-TALER_TESTING_run_merchant (const char *config_filename);
+TALER_TESTING_run_merchant (const char *config_filename,
+ const char *merchant_url);
/* ******************* Generic interpreter logic ************ */
diff --git a/src/lib/test_merchant_api_new.c b/src/lib/test_merchant_api_new.c
@@ -856,7 +856,7 @@ main (int argc,
case GNUNET_OK:
if (NULL == (merchantd =
- TALER_TESTING_run_merchant (CONFIG_FILE)))
+ TALER_TESTING_run_merchant (CONFIG_FILE, merchant_url)))
return 1;
ret = TALER_TESTING_setup_with_exchange (&run,
diff --git a/src/lib/test_merchant_api_twisted.c b/src/lib/test_merchant_api_twisted.c
@@ -854,7 +854,7 @@ main (int argc,
case GNUNET_OK:
if (NULL == (merchantd = TALER_TESTING_run_merchant
- (CONFIG_FILE)))
+ (CONFIG_FILE, merchant_url)))
// 1 is fine; after all this is merchant test cases.
return 1;
diff --git a/src/lib/testing_api_helpers.c b/src/lib/testing_api_helpers.c
@@ -41,33 +41,13 @@
* be started.
*/
struct GNUNET_OS_Process *
-TALER_TESTING_run_merchant (const char *config_filename)
+TALER_TESTING_run_merchant (const char *config_filename,
+ const char *merchant_url)
{
- struct GNUNET_CONFIGURATION_Handle *cfg;
struct GNUNET_OS_Process *merchant_proc;
unsigned int iter;
- unsigned long long port;
char *wget_cmd;
- cfg = GNUNET_CONFIGURATION_create ();
- if (GNUNET_OK !=
- GNUNET_CONFIGURATION_load (cfg,
- config_filename))
- MERCHANT_FAIL ();
- if (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_number (cfg,
- "merchant",
- "PORT",
- &port))
- {
- GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
- "merchant",
- "PORT");
- GNUNET_CONFIGURATION_destroy (cfg);
- MERCHANT_FAIL ();
- }
- GNUNET_CONFIGURATION_destroy (cfg);
-
merchant_proc
= GNUNET_OS_start_process (GNUNET_NO,
GNUNET_OS_INHERIT_STD_ALL,
@@ -80,9 +60,9 @@ TALER_TESTING_run_merchant (const char *config_filename)
MERCHANT_FAIL ();
GNUNET_asprintf (&wget_cmd,
- "wget -q -t 1 -T 1 http://127.0.0.1:%llu/"
+ "wget -q -t 1 -T 1 %s"
" -o /dev/null -O /dev/null",
- port);
+ merchant_url);
/* give child time to start and bind against the socket */
fprintf (stderr,
@@ -93,7 +73,8 @@ TALER_TESTING_run_merchant (const char *config_filename)
if (10 == iter)
{
fprintf (stderr,
- "Failed to launch `taler-merchant-httpd' (or `wget')\n");
+ "Failed to launch"
+ " `taler-merchant-httpd' (or `wget')\n");
GNUNET_OS_process_kill (merchant_proc,
SIGTERM);
GNUNET_OS_process_wait (merchant_proc);