gnunet-svn
[Top][All Lists]
Advanced

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

[taler-merchant] branch master updated (db344e1a -> 16a14fc2)


From: gnunet
Subject: [taler-merchant] branch master updated (db344e1a -> 16a14fc2)
Date: Sat, 27 May 2023 19:53:07 +0200

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

grothoff pushed a change to branch master
in repository merchant.

    from db344e1a rename .success to .ok for consistency
     new 1bfaf0a1 clean up test logic a bit
     new 16a14fc2 fix #7846, including adding test

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/backenddb/pg_expire_locks.c               | 10 ++++---
 src/backenddb/pg_expire_locks.h               |  3 +-
 src/backenddb/pg_helper.h                     | 11 ++++++++
 src/backenddb/plugin_merchantdb_postgres.c    | 11 ++------
 src/include/taler_merchantdb_plugin.h         |  3 +-
 src/testing/test_merchant_reserve_creation.sh | 40 ++++++++++++++-------------
 6 files changed, 44 insertions(+), 34 deletions(-)

diff --git a/src/backenddb/pg_expire_locks.c b/src/backenddb/pg_expire_locks.c
index 4b12ba04..7a3c3bac 100644
--- a/src/backenddb/pg_expire_locks.c
+++ b/src/backenddb/pg_expire_locks.c
@@ -25,7 +25,8 @@
 #include "pg_expire_locks.h"
 #include "pg_helper.h"
 
-void
+
+enum GNUNET_DB_QueryStatus
 TMH_PG_expire_locks (void *cls)
 {
   struct PostgresClosure *pg = cls;
@@ -49,7 +50,7 @@ TMH_PG_expire_locks (void *cls)
   if (qs1 < 0)
   {
     GNUNET_break (0);
-    return;
+    return qs1;
   }
   PREPARE (pg,
            "unlock_orders",
@@ -61,7 +62,7 @@ TMH_PG_expire_locks (void *cls)
   if (qs2 < 0)
   {
     GNUNET_break (0);
-    return;
+    return qs2;
   }
   PREPARE (pg,
            "unlock_contracts",
@@ -74,11 +75,12 @@ TMH_PG_expire_locks (void *cls)
   if (qs3 < 0)
   {
     GNUNET_break (0);
-    return;
+    return qs3;
   }
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Released %d+%d+%d locks\n",
               qs1,
               qs2,
               qs3);
+  return qs1 + qs2 + qs3;
 }
diff --git a/src/backenddb/pg_expire_locks.h b/src/backenddb/pg_expire_locks.h
index 6eac73de..55f1ff48 100644
--- a/src/backenddb/pg_expire_locks.h
+++ b/src/backenddb/pg_expire_locks.h
@@ -31,8 +31,9 @@
  * instances.
  *
  * @param cls closure
+ * @return database result code
  */
-void
+enum GNUNET_DB_QueryStatus
 TMH_PG_expire_locks (void *cls);
 
 #endif
diff --git a/src/backenddb/pg_helper.h b/src/backenddb/pg_helper.h
index 28636577..bb8e7255 100644
--- a/src/backenddb/pg_helper.h
+++ b/src/backenddb/pg_helper.h
@@ -129,4 +129,15 @@ void
 check_connection (struct PostgresClosure *pg);
 
 
+/**
+ * Do a pre-flight check that we are not in an uncommitted transaction.
+ * If we are, die.
+ * Does not return anything, as we will continue regardless of the outcome.
+ *
+ * @param cls the `struct PostgresClosure` with the plugin-specific state
+ */
+void
+postgres_preflight (void *cls);
+
+
 #endif
diff --git a/src/backenddb/plugin_merchantdb_postgres.c 
b/src/backenddb/plugin_merchantdb_postgres.c
index 3dbdae48..35d6f111 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -208,14 +208,7 @@ postgres_event_notify (void *cls,
 }
 
 
-/**
- * Do a pre-flight check that we are not in an uncommitted transaction.
- * If we are, die.
- * Does not return anything, as we will continue regardless of the outcome.
- *
- * @param cls the `struct PostgresClosure` with the plugin-specific state
- */
-static void
+void
 postgres_preflight (void *cls)
 {
   struct PostgresClosure *pg = cls;
@@ -2377,7 +2370,7 @@ RETRY:
       GNUNET_PQ_query_param_auto_from_type (reserve_pub),
       GNUNET_PQ_query_param_auto_from_type (reserve_priv),
       GNUNET_PQ_query_param_string (exchange_url),
-      GNUNET_PQ_query_param_auto_from_type (reserve_pub),
+      GNUNET_PQ_query_param_auto_from_type (master_pub),
       GNUNET_PQ_query_param_end
     };
 
diff --git a/src/include/taler_merchantdb_plugin.h 
b/src/include/taler_merchantdb_plugin.h
index d07b92f1..79f43fb8 100644
--- a/src/include/taler_merchantdb_plugin.h
+++ b/src/include/taler_merchantdb_plugin.h
@@ -1486,8 +1486,9 @@ struct TALER_MERCHANTDB_Plugin
    * instances.
    *
    * @param cls closure
+   * @return database result code
    */
-  void
+  enum GNUNET_DB_QueryStatus
   (*expire_locks)(void *cls);
 
 
diff --git a/src/testing/test_merchant_reserve_creation.sh 
b/src/testing/test_merchant_reserve_creation.sh
index cf231dd5..f68c4834 100755
--- a/src/testing/test_merchant_reserve_creation.sh
+++ b/src/testing/test_merchant_reserve_creation.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 # This file is part of TALER
-# Copyright (C) 2014-2021 Taler Systems SA
+# Copyright (C) 2014-2023 Taler Systems SA
 #
 # TALER is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as
@@ -25,6 +25,8 @@ echo -n "Configuring merchant instance ..."
 
 # create instance
 FORTYTHREE=`get_payto_uri fortythree x`
+echo -n "."
+
 STATUS=$(curl -H "Content-Type: application/json" -X POST \
     -H 'Authorization: Bearer secret-token:super_secret' \
     http://localhost:9966/management/instances \
@@ -33,8 +35,7 @@ STATUS=$(curl -H "Content-Type: application/json" -X POST \
 
 if [ "$STATUS" != "204" ]
 then
-    echo 'Expected 204, instance created. Got instead: ' $STATUS
-    exit 1
+    exit_fail "Expected 204, instance created. Got instead: $STATUS"
 fi
 echo "OK"
 
@@ -45,8 +46,7 @@ STATUS=$(curl 
'http://localhost:9966/instances/default/private/reserves' \
 
 if [ "$STATUS" != "200" ]
 then
-    echo 'Expected 200, reserve created. Got instead: ' $STATUS
-    exit 1
+    exit_fail "Expected 200, reserve created. Got instead: $STATUS"
 fi
 
 echo "OK"
@@ -60,9 +60,8 @@ FUNDED=`jq -r '.merchant_initial_amount == 
.exchange_initial_amount' < $LAST_RES
 
 if [ "$FUNDED" != "false" ]
 then
-    echo 'Should not yet be funded if we just created. Got:' $STATUS 'is 
founded: ' $FUNDED
     cat $LAST_RESPONSE
-    exit 1
+    exit_fail "Should not yet be funded if we just created. Got: $STATUS is 
founded:  $FUNDED"
 fi
 
 
@@ -94,15 +93,23 @@ taler-exchange-wirewatch -c $CONF -t -L INFO &> 
taler-exchange-wirewatch.log
 STATUS=$(curl 
'http://localhost:9966/instances/default/private/reserves/'$RESERVE_PUB \
     -w "%{http_code}" -s -o $LAST_RESPONSE)
 
+export LAST_RESPONSE
+
 FUNDED=`jq -r '.merchant_initial_amount == .exchange_initial_amount' < 
$LAST_RESPONSE`
 
 if [ "$FUNDED" != "true" ]
 then
-    echo 'should be funded. got:' $STATUS 'is founded: ' $FUNDED
     cat $LAST_RESPONSE
-    exit 1
+    exit_fail "should be funded. got: $STATUS is founded:  $FUNDED"
 fi
 
+ACCOUNTS=`jq -r '.accounts|length' < $LAST_RESPONSE`
+
+if [ "x$ACCOUNTS" != "x1" ]
+then
+    cat $LAST_RESPONSE
+    exit_fail "Expected 1 account in response. got: $ACCOUNTS"
+fi
 
 echo -n "authorizing tip ..."
 
@@ -112,8 +119,7 @@ STATUS=$(curl 
'http://localhost:9966/instances/default/private/reserves/'$RESERV
 
 if [ "$STATUS" != "200" ]
 then
-    echo 'should respond failed, we did not fund yet. got:' $STATUS
-    exit 1
+    exit_fail "should respond failed, we did not fund yet. got: $STATUS"
 fi
 
 echo OK
@@ -126,9 +132,8 @@ TIPS_SIZE=`jq -r ".tips | length"  < $LAST_RESPONSE`
 
 if [ "$TIPS_SIZE" != "1" ]
 then
-    echo 'should respond 1, just 1 tip. got:' $TIPS_SIZE
     cat $LAST_RESPONSE
-    exit 1
+    exit_fail "should respond 1, just 1 tip. got: $TIPS_SIZE"
 fi
 
 TIP_ID=`jq -r .tips[0].tip_id < $LAST_RESPONSE`
@@ -142,9 +147,8 @@ STATUS=$(curl 
'http://localhost:9966/instances/default/private/tips/'$TIP_ID \
 
 if [ "$STATUS" != "200" ]
 then
-    echo 'should respond ok, tip found. got:' $STATUS
     cat $LAST_RESPONSE
-    exit 1
+    exit_fail "should respond ok, tip found. got: $STATUS"
 fi
 
 echo -n " ... "
@@ -154,9 +158,8 @@ STATUS=$(curl 
'http://localhost:9966/instances/default/private/tips/'$TIP_ID'?pi
 
 if [ "$STATUS" != "200" ]
 then
-    echo 'should respond ok, tip found. got:' $STATUS
     cat $LAST_RESPONSE
-    exit 1
+    exit_fail "should respond ok, tip found. got: $STATUS"
 fi
 
 echo OK
@@ -169,8 +172,7 @@ STATUS=$(curl 
'http://localhost:9966/instances/default/private/reserves' \
 
 if [ "$STATUS" != "400" ]
 then
-    echo 'should respond invalid, bad currency. got:' $STATUS
-    exit 1
+    exit_fail "Should respond invalid, bad currency. got: $STATUS"
 fi
 
 echo "FAILED (which is ok)"

-- 
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]