-expand test to include coin refund

This commit is contained in:
Christian Grothoff 2022-05-17 11:46:41 +02:00
parent d8f1f7b761
commit 3b5d9daca9
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
3 changed files with 35 additions and 6 deletions

View File

@ -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?

View File

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

View File

@ -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 ()
};