add option to be selective about dropping the exchange list

This commit is contained in:
Christian Grothoff 2019-02-14 14:23:16 +01:00
parent e56ed85f4f
commit a98825675b
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
7 changed files with 32 additions and 47 deletions

View File

@ -1,4 +0,0 @@
test_auditor_api
test_exchange_api_home/.local/share/taler/auditors/
test_exchange_api_home/.local/share/taler/exchange/live-keys/
auditor.in

View File

@ -64,7 +64,8 @@ run (void *cls,
return;
}
if (reset_db)
(void) plugin->drop_tables (plugin->cls);
(void) plugin->drop_tables (plugin->cls,
GNUNET_YES);
if (GNUNET_OK !=
plugin->create_tables (plugin->cls))
{

View File

@ -2489,7 +2489,7 @@ get_wire_fee (struct AggregationContext *ac,
* @return #GNUNET_OK to continue, #GNUNET_SYSERR to stop iteration
*/
static int
check_wire_out_cb
check_wire_out_cb
(void *cls,
uint64_t rowid,
struct GNUNET_TIME_Absolute date,
@ -4391,7 +4391,7 @@ test_master_present (void *cls,
const char *exchange_url)
{
int *found = cls;
(void) exchange_url;
if (0 == memcmp (mpub,
&master_pub,
@ -4529,7 +4529,8 @@ run (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Full audit restart requested, dropping old audit data.\n");
GNUNET_break (GNUNET_OK ==
adb->drop_tables (adb->cls));
adb->drop_tables (adb->cls,
GNUNET_NO));
TALER_AUDITORDB_plugin_unload (adb);
if (NULL ==
(adb = TALER_AUDITORDB_plugin_load (cfg)))

View File

@ -1605,7 +1605,8 @@ run (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Full audit restart requested, dropping old audit data.\n");
GNUNET_break (GNUNET_OK ==
adb->drop_tables (adb->cls));
adb->drop_tables (adb->cls,
GNUNET_NO));
TALER_AUDITORDB_plugin_unload (adb);
if (NULL ==
(adb = TALER_AUDITORDB_plugin_load (cfg)))

View File

@ -131,10 +131,12 @@ connect_to_postgres (struct PostgresClosure *pc)
* Drop all Taler tables. This should only be used by testcases.
*
* @param cls the `struct PostgresClosure` with the plugin-specific state
* @param drop_exchangelist should we also drop the exchange table?
* @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure
*/
static int
postgres_drop_tables (void *cls)
postgres_drop_tables (void *cls,
int drop_exchangelist)
{
struct PostgresClosure *pc = cls;
struct GNUNET_PQ_ExecuteStatement es[] = {
@ -152,10 +154,13 @@ postgres_drop_tables (void *cls)
GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS auditor_progress_deposit_confirmation;"),
GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS auditor_progress_coin;"),
GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS wire_auditor_progress;"),
GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS auditor_exchanges CASCADE;"),
GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS deposit_confirmations CASCADE;"),
GNUNET_PQ_EXECUTE_STATEMENT_END
};
struct GNUNET_PQ_ExecuteStatement esx[] = {
GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS auditor_exchanges CASCADE;"),
GNUNET_PQ_EXECUTE_STATEMENT_END
};
PGconn *conn;
int ret;
@ -166,6 +171,10 @@ postgres_drop_tables (void *cls)
"Dropping ALL tables\n");
ret = GNUNET_PQ_exec_statements (conn,
es);
if ( (ret >= 0) &&
(drop_exchangelist) )
ret = GNUNET_PQ_exec_statements (conn,
esx);
/* TODO: we probably need a bit more fine-grained control
over drops for the '-r' option of taler-auditor; also,
for the testcase, we currently fail to drop the

View File

@ -401,10 +401,12 @@ struct TALER_AUDITORDB_Plugin
* Drop the Taler tables. This should only be used in testcases.
*
* @param cls the @e cls of this struct with the plugin-specific state
* @param drop_exchangelist should we also drop the list of audited exchanges
* @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure
*/
int
(*drop_tables) (void *cls);
(*drop_tables) (void *cls,
int drop_exchangelist);
/**

View File

@ -292,77 +292,66 @@ run (void *cls,
"EUR:10.10",
42,
2),
TALER_TESTING_cmd_check_bank_transfer
("check-massive-transfer-1",
exchange_url,
"EUR:0.98",
2,
43),
TALER_TESTING_cmd_check_bank_transfer
("check-massive-transfer-2",
exchange_url,
"EUR:0.98",
2,
43),
TALER_TESTING_cmd_check_bank_transfer
("check-massive-transfer-3",
exchange_url,
"EUR:0.98",
2,
43),
TALER_TESTING_cmd_check_bank_transfer
("check-massive-transfer-4",
exchange_url,
"EUR:0.98",
2,
43),
TALER_TESTING_cmd_check_bank_transfer
("check-massive-transfer-5",
exchange_url,
"EUR:0.98",
2,
43),
TALER_TESTING_cmd_check_bank_transfer
("check-massive-transfer-6",
exchange_url,
"EUR:0.98",
2,
43),
TALER_TESTING_cmd_check_bank_transfer
("check-massive-transfer-7",
exchange_url,
"EUR:0.98",
2,
43),
TALER_TESTING_cmd_check_bank_transfer
("check-massive-transfer-8",
exchange_url,
"EUR:0.98",
2,
43),
TALER_TESTING_cmd_check_bank_transfer
("check-massive-transfer-9",
exchange_url,
"EUR:0.98",
2,
43),
TALER_TESTING_cmd_check_bank_transfer
("check-massive-transfer-10",
exchange_url,
"EUR:0.98",
2,
43),
TALER_TESTING_cmd_check_bank_empty ("check_bank_empty"),
TALER_TESTING_cmd_end ()
};
@ -559,9 +548,7 @@ run (void *cls,
*/
CMD_TRANSFER_TO_EXCHANGE ("massive-reserve",
"EUR:10.10"),
CMD_EXEC_WIREWATCH ("massive-wirewatch"),
TALER_TESTING_cmd_withdraw_amount ("massive-withdraw-1",
"massive-reserve",
"EUR:1",
@ -615,130 +602,118 @@ run (void *cls,
("massive-deposit-1",
"massive-withdraw-1",
0,
TALER_TESTING_make_wire_details
TALER_TESTING_make_wire_details
(43,
fakebank_url),
"{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}",
GNUNET_TIME_UNIT_ZERO,
"EUR:1",
MHD_HTTP_OK),
TALER_TESTING_cmd_deposit
("massive-deposit-2",
"massive-withdraw-2",
0,
TALER_TESTING_make_wire_details
TALER_TESTING_make_wire_details
(43,
fakebank_url),
"{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}",
GNUNET_TIME_UNIT_ZERO,
"EUR:1",
MHD_HTTP_OK),
TALER_TESTING_cmd_deposit
("massive-deposit-3",
"massive-withdraw-3",
0,
TALER_TESTING_make_wire_details
TALER_TESTING_make_wire_details
(43,
fakebank_url),
"{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}",
GNUNET_TIME_UNIT_ZERO,
"EUR:1",
MHD_HTTP_OK),
TALER_TESTING_cmd_deposit
("massive-deposit-4",
"massive-withdraw-4",
0,
TALER_TESTING_make_wire_details
TALER_TESTING_make_wire_details
(43,
fakebank_url),
"{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}",
GNUNET_TIME_UNIT_ZERO,
"EUR:1",
MHD_HTTP_OK),
TALER_TESTING_cmd_deposit
("massive-deposit-5",
"massive-withdraw-5",
0,
TALER_TESTING_make_wire_details
TALER_TESTING_make_wire_details
(43,
fakebank_url),
"{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}",
GNUNET_TIME_UNIT_ZERO,
"EUR:1",
MHD_HTTP_OK),
TALER_TESTING_cmd_deposit
("massive-deposit-6",
"massive-withdraw-6",
0,
TALER_TESTING_make_wire_details
TALER_TESTING_make_wire_details
(43,
fakebank_url),
"{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}",
GNUNET_TIME_UNIT_ZERO,
"EUR:1",
MHD_HTTP_OK),
TALER_TESTING_cmd_deposit
("massive-deposit-7",
"massive-withdraw-7",
0,
TALER_TESTING_make_wire_details
TALER_TESTING_make_wire_details
(43,
fakebank_url),
"{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}",
GNUNET_TIME_UNIT_ZERO,
"EUR:1",
MHD_HTTP_OK),
TALER_TESTING_cmd_deposit
("massive-deposit-8",
"massive-withdraw-8",
0,
TALER_TESTING_make_wire_details
TALER_TESTING_make_wire_details
(43,
fakebank_url),
"{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}",
GNUNET_TIME_UNIT_ZERO,
"EUR:1",
MHD_HTTP_OK),
TALER_TESTING_cmd_deposit
("massive-deposit-9",
"massive-withdraw-9",
0,
TALER_TESTING_make_wire_details
TALER_TESTING_make_wire_details
(43,
fakebank_url),
"{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}",
GNUNET_TIME_UNIT_ZERO,
"EUR:1",
MHD_HTTP_OK),
TALER_TESTING_cmd_deposit
("massive-deposit-10",
"massive-withdraw-10",
0,
TALER_TESTING_make_wire_details
TALER_TESTING_make_wire_details
(43,
fakebank_url),
"{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}",
GNUNET_TIME_UNIT_ZERO,
"EUR:1",
MHD_HTTP_OK),
CMD_RUN_AUDITOR("massive-auditor"),
TALER_TESTING_cmd_end ()
};
struct TALER_TESTING_Command commands[] = {
CMD_RUN_AUDITOR ("virgin-auditor"),
CMD_RUN_WIRE_AUDITOR ("virgin-wire-auditor"),
TALER_TESTING_cmd_exchanges_with_url ("check-exchange",