-fix FTBFS of exchange test
This commit is contained in:
parent
ab03ba16e9
commit
64b2bc4558
@ -300,7 +300,7 @@ noinst_PROGRAMS = \
|
||||
|
||||
AM_TESTS_ENVIRONMENT=export TALER_PREFIX=$${TALER_PREFIX:-@libdir@};export PATH=$${TALER_PREFIX:-@prefix@}/bin:$$PATH;
|
||||
TESTS = \
|
||||
(check_PROGRAMS)
|
||||
$(check_PROGRAMS)
|
||||
test_exchangedb_postgres_SOURCES = \
|
||||
test_exchangedb.c
|
||||
test_exchangedb_postgres_LDADD = \
|
||||
|
@ -80,7 +80,6 @@ transaction_duplicate= TRUE;
|
||||
END IF;
|
||||
CLOSE curs;
|
||||
|
||||
PERFORM pg_notify(in_notify, NULL);
|
||||
OPEN curs_trans FOR
|
||||
WITH reserve_transaction AS(
|
||||
INSERT INTO reserves_in
|
||||
@ -109,6 +108,7 @@ transaction_duplicate= TRUE;
|
||||
THEN
|
||||
-- HAPPY PATH THERE IS NO DUPLICATE TRANS
|
||||
transaction_duplicate = FALSE;
|
||||
PERFORM pg_notify(in_notify, NULL);
|
||||
END IF;
|
||||
END IF;
|
||||
CLOSE curs_trans;
|
||||
|
@ -67,7 +67,7 @@ insert1 (struct PostgresClosure *pg,
|
||||
uint64_t *reserve_uuid,
|
||||
enum GNUNET_DB_QueryStatus results[1])
|
||||
{
|
||||
enum GNUNET_DB_QueryStatus qs2;
|
||||
enum GNUNET_DB_QueryStatus qs;
|
||||
PREPARE (pg,
|
||||
"batch1_reserve_create",
|
||||
"SELECT "
|
||||
@ -91,7 +91,6 @@ insert1 (struct PostgresClosure *pg,
|
||||
GNUNET_PQ_query_param_string (notify_s[0]),
|
||||
GNUNET_PQ_query_param_end
|
||||
};
|
||||
|
||||
struct GNUNET_PQ_ResultSpec rs[] = {
|
||||
GNUNET_PQ_result_spec_bool ("conflicted",
|
||||
&conflict[0]),
|
||||
@ -102,24 +101,21 @@ insert1 (struct PostgresClosure *pg,
|
||||
GNUNET_PQ_result_spec_end
|
||||
};
|
||||
|
||||
|
||||
TALER_payto_hash (reserves[0].sender_account_details,
|
||||
&h_payto);
|
||||
|
||||
qs2 = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
|
||||
"batch1_reserve_create",
|
||||
params,
|
||||
rs);
|
||||
|
||||
if (qs2 < 0)
|
||||
qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
|
||||
"batch1_reserve_create",
|
||||
params,
|
||||
rs);
|
||||
if (qs < 0)
|
||||
{
|
||||
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
|
||||
"Failed to create reserves 1(%d)\n",
|
||||
qs2);
|
||||
results[0] = qs2;
|
||||
return qs2;
|
||||
qs);
|
||||
results[0] = qs;
|
||||
return qs;
|
||||
}
|
||||
GNUNET_assert (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS != qs2);
|
||||
GNUNET_assert (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS != qs);
|
||||
if ((! conflict[0]) && transaction_duplicate[0])
|
||||
{
|
||||
GNUNET_break (0);
|
||||
@ -128,7 +124,7 @@ insert1 (struct PostgresClosure *pg,
|
||||
return GNUNET_DB_STATUS_HARD_ERROR;
|
||||
}
|
||||
results[0] = GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
|
||||
return qs2;
|
||||
return qs;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1289,15 +1289,26 @@ run (void *cls)
|
||||
&amount_with_fee));
|
||||
result = 4;
|
||||
now = GNUNET_TIME_timestamp_get ();
|
||||
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
|
||||
plugin->reserves_in_insert (plugin->cls,
|
||||
&reserve_pub,
|
||||
&value,
|
||||
now,
|
||||
sndr,
|
||||
"exchange-account-1",
|
||||
4));
|
||||
{
|
||||
struct TALER_EXCHANGEDB_ReserveInInfo reserve = {
|
||||
.reserve_pub = &reserve_pub,
|
||||
.balance = &value,
|
||||
.execution_time = now,
|
||||
.sender_account_details = sndr,
|
||||
.exchange_account_name = "exchange-account-1",
|
||||
.wire_reference = 4
|
||||
};
|
||||
enum GNUNET_DB_QueryStatus qsr;
|
||||
|
||||
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
|
||||
plugin->reserves_in_insert (plugin->cls,
|
||||
&reserve,
|
||||
1,
|
||||
1,
|
||||
&qsr));
|
||||
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
|
||||
qsr);
|
||||
}
|
||||
FAILIF (GNUNET_OK !=
|
||||
check_reserve (&reserve_pub,
|
||||
value.value,
|
||||
@ -1305,14 +1316,26 @@ run (void *cls)
|
||||
value.currency));
|
||||
now = GNUNET_TIME_timestamp_get ();
|
||||
RND_BLK (&reserve_pub2);
|
||||
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
|
||||
plugin->reserves_in_insert (plugin->cls,
|
||||
&reserve_pub2,
|
||||
&value,
|
||||
now,
|
||||
sndr,
|
||||
"exchange-account-1",
|
||||
5));
|
||||
{
|
||||
struct TALER_EXCHANGEDB_ReserveInInfo reserve = {
|
||||
.reserve_pub = &reserve_pub2,
|
||||
.balance = &value,
|
||||
.execution_time = now,
|
||||
.sender_account_details = sndr,
|
||||
.exchange_account_name = "exchange-account-1",
|
||||
.wire_reference = 5
|
||||
};
|
||||
enum GNUNET_DB_QueryStatus qsr;
|
||||
|
||||
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
|
||||
plugin->reserves_in_insert (plugin->cls,
|
||||
&reserve,
|
||||
1,
|
||||
1,
|
||||
&qsr));
|
||||
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
|
||||
qsr);
|
||||
}
|
||||
FAILIF (GNUNET_OK !=
|
||||
check_reserve (&reserve_pub,
|
||||
value.value,
|
||||
|
Loading…
Reference in New Issue
Block a user