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