gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-merchant] branch master updated: -fail on testserver start if por


From: gnunet
Subject: [taler-merchant] branch master updated: -fail on testserver start if port is in use
Date: Mon, 06 Feb 2023 17:00:13 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository merchant.

The following commit(s) were added to refs/heads/master by this push:
     new 66059c8e -fail on testserver start if port is in use
66059c8e is described below

commit 66059c8ea7384eda126b2bc6d1df7cc2f510f57d
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Mon Feb 6 17:00:10 2023 +0100

    -fail on testserver start if port is in use
---
 src/testing/test_merchant_api.c             | 32 ++++++++++++++---------------
 src/testing/testing_api_cmd_post_webhooks.c |  6 +++---
 src/testing/testing_api_cmd_testserver.c    | 16 ++++++++++-----
 3 files changed, 30 insertions(+), 24 deletions(-)

diff --git a/src/testing/test_merchant_api.c b/src/testing/test_merchant_api.c
index bf4c13cb..1d8a4d96 100644
--- a/src/testing/test_merchant_api.c
+++ b/src/testing/test_merchant_api.c
@@ -169,7 +169,7 @@ const char *order_1_forgets_3[] = {
  * @param label label to use for the command.
  */
 static struct TALER_TESTING_Command
-cmd_webhook(const char *label)
+cmd_webhook (const char *label)
 {
   return TALER_TESTING_cmd_webhook (label, config_file);
 }
@@ -435,13 +435,13 @@ run (void *cls,
                                                   "poll-order-wallet-start-1"),
     /* Check for webhook */
     cmd_webhook ("pending-webhooks-pay-w1"),
-    /* FIXME: check webhook did anything: have a command that inspects traits 
of the testserver
+    /* Check webhook did anything: have a command that inspects traits of the 
testserver
      and check if the traits have the right values set! */
     TALER_TESTING_cmd_checkserver ("check-http-server-for-webhooks",
                                    "http://localhost:12345/";,
                                    "POST",
-                                   "Authorization:EFEHYJS",
-                                   "{{amount.val}}.{{amount.frac}} 
{{amount.currecy}}",
+                                   "Authorization: EFEHYJS",
+                                   "5.0 EUR",
                                    12345),
     /* Here we expect to run into a timeout, as we do not pay this one */
     TALER_TESTING_cmd_wallet_poll_order_conclude2 ("poll-order-1x-conclude",
@@ -1368,9 +1368,9 @@ run (void *cls,
       "another template",
       "data:image/jpeg;base64,RAWDATA",
       GNUNET_JSON_PACK (
-      GNUNET_JSON_pack_uint64 ("minimum_age", 0),
-      GNUNET_JSON_pack_time_rel ("pay_duration",
-                                 GNUNET_TIME_UNIT_MINUTES)),
+        GNUNET_JSON_pack_uint64 ("minimum_age", 0),
+        GNUNET_JSON_pack_time_rel ("pay_duration",
+                                   GNUNET_TIME_UNIT_MINUTES)),
       MHD_HTTP_NO_CONTENT),
     TALER_TESTING_cmd_merchant_get_template ("get-template-t2",
                                              merchant_url,
@@ -1389,9 +1389,9 @@ run (void *cls,
       "updated template",
       "data:image/jpeg;base64,RAWDATA",
       GNUNET_JSON_PACK (
-      GNUNET_JSON_pack_uint64 ("minimum_age", 0),
-      GNUNET_JSON_pack_time_rel ("pay_duration",
-                                 GNUNET_TIME_UNIT_MINUTES)),
+        GNUNET_JSON_pack_uint64 ("minimum_age", 0),
+        GNUNET_JSON_pack_time_rel ("pay_duration",
+                                   GNUNET_TIME_UNIT_MINUTES)),
       MHD_HTTP_NOT_FOUND),
     TALER_TESTING_cmd_merchant_post_templates2 (
       "post-templates-t3-amount",
@@ -1400,11 +1400,11 @@ run (void *cls,
       "a different template with an amount",
       NULL,
       GNUNET_JSON_PACK (
-                        GNUNET_JSON_pack_uint64 ("minimum_age", 0),
-                        GNUNET_JSON_pack_time_rel ("pay_duration",
-                                                   GNUNET_TIME_UNIT_MINUTES),
-                        GNUNET_JSON_pack_string ("amount",
-                                                 "EUR:4")),
+        GNUNET_JSON_pack_uint64 ("minimum_age", 0),
+        GNUNET_JSON_pack_time_rel ("pay_duration",
+                                   GNUNET_TIME_UNIT_MINUTES),
+        GNUNET_JSON_pack_string ("amount",
+                                 "EUR:4")),
       MHD_HTTP_NO_CONTENT),
     TALER_TESTING_cmd_merchant_post_using_templates (
       "using-templates-t1",
@@ -1458,7 +1458,7 @@ run (void *cls,
       MHD_HTTP_NOT_FOUND),
     TALER_TESTING_cmd_end ()
   };
-  
+
   struct TALER_TESTING_Command webhooks[] = {
     TALER_TESTING_cmd_merchant_get_webhooks ("get-webhooks-empty",
                                              merchant_url,
diff --git a/src/testing/testing_api_cmd_post_webhooks.c 
b/src/testing/testing_api_cmd_post_webhooks.c
index 77ab1213..2a16a990 100644
--- a/src/testing/testing_api_cmd_post_webhooks.c
+++ b/src/testing/testing_api_cmd_post_webhooks.c
@@ -78,7 +78,7 @@ struct PostWebhooksState
   * body of the webhook
   */
   const char *body_template;
-  
+
   /**
    * Expected HTTP response code.
    */
@@ -270,8 +270,8 @@ TALER_TESTING_cmd_merchant_post_webhooks (const char *label,
     event_type,
     "http://localhost:12345/";,
     "POST",
-    "Authorization:EFEHYJS",
-    "{{amount.val}}.{{amount.frac}} {{amount.currecy}}",
+    "Authorization: EFEHYJS",
+    "{{amount.val}}.{{amount.frac}} {{amount.currency}}",
     http_status);
 }
 
diff --git a/src/testing/testing_api_cmd_testserver.c 
b/src/testing/testing_api_cmd_testserver.c
index 7e0b0a4b..0becdbde 100644
--- a/src/testing/testing_api_cmd_testserver.c
+++ b/src/testing/testing_api_cmd_testserver.c
@@ -191,8 +191,8 @@ handler_cb (void *cls,
   }
 
   body = GNUNET_JSON_PACK (
-                           GNUNET_JSON_pack_string ("something",
-                                                    "good"));
+    GNUNET_JSON_pack_string ("something",
+                             "good"));
   return TALER_MHD_reply_json_steal (connection,
                                      body,
                                      MHD_HTTP_OK);
@@ -237,6 +237,12 @@ testserver_run (void *cls,
                                &handler_cb, ser,
                                MHD_OPTION_NOTIFY_COMPLETED, &cleanup, NULL,
                                NULL);
+  if (NULL == ser->mhd)
+  {
+    GNUNET_break (0);
+    TALER_TESTING_interpreter_fail (is);
+    return;
+  }
   TALER_TESTING_interpreter_next (is);
 }
 
@@ -250,7 +256,7 @@ testserver_run (void *cls,
  */
 static void
 testserver_cleanup (void *cls,
-               const struct TALER_TESTING_Command *cmd)
+                    const struct TALER_TESTING_Command *cmd)
 {
   struct TestserverState *ser = cls;
 
@@ -264,7 +270,6 @@ testserver_cleanup (void *cls,
 }
 
 
-
 /**
  * This function is used to start the web server.
  *
@@ -313,6 +318,7 @@ traits_testserver (void *cls,
                                   index);
 }
 
+
 /**
  * This function is used to check the web server
  *
@@ -340,7 +346,7 @@ TALER_TESTING_cmd_checkserver (const char *label,
   ser->body = body;
   ser->port = port;
   {
-    struct TALER_TESTING_Command cmd= {
+    struct TALER_TESTING_Command cmd = {
       .cls = ser,
       .label = label,
       .run = &testserver_run,

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]