gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated: -expand test to include coin ref


From: gnunet
Subject: [taler-exchange] branch master updated: -expand test to include coin refund
Date: Tue, 17 May 2022 11:46:43 +0200

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

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new 3b5d9dac -expand test to include coin refund
3b5d9dac is described below

commit 3b5d9daca9a621bd85778a7ad271a9d594dae0dd
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Tue May 17 11:46:41 2022 +0200

    -expand test to include coin refund
---
 src/exchange/exchange.conf           |  2 +-
 src/exchange/taler-exchange-expire.c |  6 +++---
 src/testing/test_exchange_p2p.c      | 33 +++++++++++++++++++++++++++++++--
 3 files changed, 35 insertions(+), 6 deletions(-)

diff --git a/src/exchange/exchange.conf b/src/exchange/exchange.conf
index df136d9e..58e57c82 100644
--- a/src/exchange/exchange.conf
+++ b/src/exchange/exchange.conf
@@ -54,7 +54,7 @@ ROUTER_IDLE_SLEEP_INTERVAL = 60 s
 # by taler-exchange-expire (in time).  It may take
 # this much time for an expired purse to be really
 # cleaned up and the coins refunded.
-EXPIRE_SHARD_SIZE = 5 m
+EXPIRE_SHARD_SIZE = 1 h
 
 # How long should the transfer tool
 # sleep if it has nothing to do?
diff --git a/src/exchange/taler-exchange-expire.c 
b/src/exchange/taler-exchange-expire.c
index b5df64a7..d99c430e 100644
--- a/src/exchange/taler-exchange-expire.c
+++ b/src/exchange/taler-exchange-expire.c
@@ -392,13 +392,13 @@ run_shard (void *cls)
     GNUNET_SCHEDULER_shutdown ();
     return;
   }
-  if (GNUNET_TIME_absolute_is_future (s->shard_start))
+  if (GNUNET_TIME_absolute_is_future (s->shard_end))
   {
+    abort_shard (s);
     GNUNET_assert (NULL == task);
-    task = GNUNET_SCHEDULER_add_at (s->shard_start,
+    task = GNUNET_SCHEDULER_add_at (s->shard_end,
                                     &run_shard,
                                     NULL);
-    abort_shard (s);
     return;
   }
   /* If this is a first-time run, we immediately
diff --git a/src/testing/test_exchange_p2p.c b/src/testing/test_exchange_p2p.c
index ec3c660c..a20649f4 100644
--- a/src/testing/test_exchange_p2p.c
+++ b/src/testing/test_exchange_p2p.c
@@ -281,7 +281,7 @@ run (void *cls,
     TALER_TESTING_cmd_purse_create_with_reserve (
       "purse-create-with-reserve-expire",
       MHD_HTTP_OK,
-      "{\"amount\":\"EUR:1\",\"summary\":\"ice cream\"}",
+      "{\"amount\":\"EUR:2\",\"summary\":\"ice cream\"}",
       true /* upload contract */,
       GNUNET_TIME_relative_multiply (
         GNUNET_TIME_UNIT_SECONDS,
@@ -312,6 +312,20 @@ run (void *cls,
       "EUR:1",
       true,
       GNUNET_TIME_UNIT_MINUTES),
+    /* This should fail, as too much of the coin
+       is already spend / in a purse */
+    TALER_TESTING_cmd_purse_create_with_deposit (
+      "purse-with-deposit-overspending",
+      MHD_HTTP_CONFLICT,
+      "{\"amount\":\"EUR:2\",\"summary\":\"ice cream\"}",
+      true, /* upload contract */
+      GNUNET_TIME_relative_multiply (
+        GNUNET_TIME_UNIT_SECONDS,
+        1), /* expiration */
+      "withdraw-coin-1",
+      "EUR:2.01",
+      NULL),
+
     TALER_TESTING_cmd_sleep ("sleep",
                              2 /* seconds */),
     TALER_TESTING_cmd_exec_expire ("exec-expire",
@@ -328,7 +342,22 @@ run (void *cls,
         GNUNET_TIME_UNIT_SECONDS,
         15),
       "pull-poll-purse-before-expire"),
-    // FIXME: check coin was refunded
+    /* coin was refunded, so now this should be OK */
+    /* This should fail, as too much of the coin
+       is already spend / in a purse */
+    TALER_TESTING_cmd_purse_create_with_deposit (
+      "purse-with-deposit-refunded",
+      MHD_HTTP_OK,
+      "{\"amount\":\"EUR:2\",\"summary\":\"ice cream\"}",
+      true, /* upload contract */
+      GNUNET_TIME_relative_multiply (
+        GNUNET_TIME_UNIT_SECONDS,
+        1), /* expiration */
+      "withdraw-coin-1",
+      "EUR:2.01",
+      NULL),
+
+
     // FIXME: check reserve purse capacity is back up!
     TALER_TESTING_cmd_end ()
   };

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