diff options
Diffstat (limited to 'src/auditordb/test_auditordb.c')
-rw-r--r-- | src/auditordb/test_auditordb.c | 57 |
1 files changed, 9 insertions, 48 deletions
diff --git a/src/auditordb/test_auditordb.c b/src/auditordb/test_auditordb.c index 69328ee48..237d8ec83 100644 --- a/src/auditordb/test_auditordb.c +++ b/src/auditordb/test_auditordb.c | |||
@@ -73,7 +73,6 @@ static void | |||
73 | run (void *cls) | 73 | run (void *cls) |
74 | { | 74 | { |
75 | struct GNUNET_CONFIGURATION_Handle *cfg = cls; | 75 | struct GNUNET_CONFIGURATION_Handle *cfg = cls; |
76 | struct TALER_AUDITORDB_Session *session; | ||
77 | uint64_t rowid; | 76 | uint64_t rowid; |
78 | 77 | ||
79 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 78 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
@@ -94,16 +93,15 @@ run (void *cls) | |||
94 | result = 77; | 93 | result = 77; |
95 | goto unload; | 94 | goto unload; |
96 | } | 95 | } |
97 | if (NULL == | 96 | if (GNUNET_SYSERR == |
98 | (session = plugin->get_session (plugin->cls))) | 97 | plugin->preflight (plugin->cls)) |
99 | { | 98 | { |
100 | result = 77; | 99 | result = 77; |
101 | goto drop; | 100 | goto drop; |
102 | } | 101 | } |
103 | 102 | ||
104 | FAILIF (GNUNET_OK != | 103 | FAILIF (GNUNET_OK != |
105 | plugin->start (plugin->cls, | 104 | plugin->start (plugin->cls)); |
106 | session)); | ||
107 | 105 | ||
108 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 106 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
109 | "initializing\n"); | 107 | "initializing\n"); |
@@ -164,7 +162,6 @@ run (void *cls) | |||
164 | "Test: auditor_insert_exchange\n"); | 162 | "Test: auditor_insert_exchange\n"); |
165 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 163 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
166 | plugin->insert_exchange (plugin->cls, | 164 | plugin->insert_exchange (plugin->cls, |
167 | session, | ||
168 | &master_pub, | 165 | &master_pub, |
169 | "https://exchange/")); | 166 | "https://exchange/")); |
170 | 167 | ||
@@ -187,7 +184,6 @@ run (void *cls) | |||
187 | 184 | ||
188 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 185 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
189 | plugin->insert_auditor_progress_coin (plugin->cls, | 186 | plugin->insert_auditor_progress_coin (plugin->cls, |
190 | session, | ||
191 | &master_pub, | 187 | &master_pub, |
192 | &ppc)); | 188 | &ppc)); |
193 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 189 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
@@ -200,7 +196,6 @@ run (void *cls) | |||
200 | 196 | ||
201 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 197 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
202 | plugin->update_auditor_progress_coin (plugin->cls, | 198 | plugin->update_auditor_progress_coin (plugin->cls, |
203 | session, | ||
204 | &master_pub, | 199 | &master_pub, |
205 | &ppc)); | 200 | &ppc)); |
206 | 201 | ||
@@ -209,7 +204,6 @@ run (void *cls) | |||
209 | 204 | ||
210 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 205 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
211 | plugin->get_auditor_progress_coin (plugin->cls, | 206 | plugin->get_auditor_progress_coin (plugin->cls, |
212 | session, | ||
213 | &master_pub, | 207 | &master_pub, |
214 | &ppc2)); | 208 | &ppc2)); |
215 | FAILIF ( (ppc.last_deposit_serial_id != ppc2.last_deposit_serial_id) || | 209 | FAILIF ( (ppc.last_deposit_serial_id != ppc2.last_deposit_serial_id) || |
@@ -233,7 +227,6 @@ run (void *cls) | |||
233 | 227 | ||
234 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 228 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
235 | plugin->insert_reserve_info (plugin->cls, | 229 | plugin->insert_reserve_info (plugin->cls, |
236 | session, | ||
237 | &reserve_pub, | 230 | &reserve_pub, |
238 | &master_pub, | 231 | &master_pub, |
239 | &reserve_balance, | 232 | &reserve_balance, |
@@ -246,7 +239,6 @@ run (void *cls) | |||
246 | 239 | ||
247 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 240 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
248 | plugin->update_reserve_info (plugin->cls, | 241 | plugin->update_reserve_info (plugin->cls, |
249 | session, | ||
250 | &reserve_pub, | 242 | &reserve_pub, |
251 | &master_pub, | 243 | &master_pub, |
252 | &reserve_balance, | 244 | &reserve_balance, |
@@ -260,7 +252,6 @@ run (void *cls) | |||
260 | 252 | ||
261 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 253 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
262 | plugin->get_reserve_info (plugin->cls, | 254 | plugin->get_reserve_info (plugin->cls, |
263 | session, | ||
264 | &reserve_pub, | 255 | &reserve_pub, |
265 | &master_pub, | 256 | &master_pub, |
266 | &rowid, | 257 | &rowid, |
@@ -281,7 +272,6 @@ run (void *cls) | |||
281 | 272 | ||
282 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 273 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
283 | plugin->insert_reserve_summary (plugin->cls, | 274 | plugin->insert_reserve_summary (plugin->cls, |
284 | session, | ||
285 | &master_pub, | 275 | &master_pub, |
286 | &withdraw_fee_balance, | 276 | &withdraw_fee_balance, |
287 | &reserve_balance)); | 277 | &reserve_balance)); |
@@ -291,7 +281,6 @@ run (void *cls) | |||
291 | 281 | ||
292 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 282 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
293 | plugin->update_reserve_summary (plugin->cls, | 283 | plugin->update_reserve_summary (plugin->cls, |
294 | session, | ||
295 | &master_pub, | 284 | &master_pub, |
296 | &reserve_balance, | 285 | &reserve_balance, |
297 | &withdraw_fee_balance)); | 286 | &withdraw_fee_balance)); |
@@ -304,7 +293,6 @@ run (void *cls) | |||
304 | 293 | ||
305 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 294 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
306 | plugin->get_reserve_summary (plugin->cls, | 295 | plugin->get_reserve_summary (plugin->cls, |
307 | session, | ||
308 | &master_pub, | 296 | &master_pub, |
309 | &reserve_balance2, | 297 | &reserve_balance2, |
310 | &withdraw_fee_balance2)); | 298 | &withdraw_fee_balance2)); |
@@ -362,7 +350,6 @@ run (void *cls) | |||
362 | 350 | ||
363 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 351 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
364 | plugin->insert_denomination_balance (plugin->cls, | 352 | plugin->insert_denomination_balance (plugin->cls, |
365 | session, | ||
366 | &denom_pub_hash, | 353 | &denom_pub_hash, |
367 | &denom_balance, | 354 | &denom_balance, |
368 | &denom_loss, | 355 | &denom_loss, |
@@ -380,7 +367,6 @@ run (void *cls) | |||
380 | 367 | ||
381 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 368 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
382 | plugin->update_denomination_balance (plugin->cls, | 369 | plugin->update_denomination_balance (plugin->cls, |
383 | session, | ||
384 | &denom_pub_hash, | 370 | &denom_pub_hash, |
385 | &denom_balance, | 371 | &denom_balance, |
386 | &denom_loss, | 372 | &denom_loss, |
@@ -392,7 +378,6 @@ run (void *cls) | |||
392 | 378 | ||
393 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 379 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
394 | plugin->get_denomination_balance (plugin->cls, | 380 | plugin->get_denomination_balance (plugin->cls, |
395 | session, | ||
396 | &denom_pub_hash, | 381 | &denom_pub_hash, |
397 | &denom_balance2, | 382 | &denom_balance2, |
398 | &denom_loss2, | 383 | &denom_loss2, |
@@ -411,7 +396,6 @@ run (void *cls) | |||
411 | 396 | ||
412 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 397 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
413 | plugin->insert_balance_summary (plugin->cls, | 398 | plugin->insert_balance_summary (plugin->cls, |
414 | session, | ||
415 | &master_pub, | 399 | &master_pub, |
416 | &refund_fee_balance, | 400 | &refund_fee_balance, |
417 | &melt_fee_balance, | 401 | &melt_fee_balance, |
@@ -426,7 +410,6 @@ run (void *cls) | |||
426 | 410 | ||
427 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 411 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
428 | plugin->update_balance_summary (plugin->cls, | 412 | plugin->update_balance_summary (plugin->cls, |
429 | session, | ||
430 | &master_pub, | 413 | &master_pub, |
431 | &denom_balance, | 414 | &denom_balance, |
432 | &deposit_fee_balance, | 415 | &deposit_fee_balance, |
@@ -449,7 +432,6 @@ run (void *cls) | |||
449 | 432 | ||
450 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 433 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
451 | plugin->get_balance_summary (plugin->cls, | 434 | plugin->get_balance_summary (plugin->cls, |
452 | session, | ||
453 | &master_pub, | 435 | &master_pub, |
454 | &denom_balance2, | 436 | &denom_balance2, |
455 | &deposit_fee_balance2, | 437 | &deposit_fee_balance2, |
@@ -480,7 +462,6 @@ run (void *cls) | |||
480 | 462 | ||
481 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 463 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
482 | plugin->insert_historic_denom_revenue (plugin->cls, | 464 | plugin->insert_historic_denom_revenue (plugin->cls, |
483 | session, | ||
484 | &master_pub, | 465 | &master_pub, |
485 | &denom_pub_hash, | 466 | &denom_pub_hash, |
486 | past, | 467 | past, |
@@ -489,7 +470,6 @@ run (void *cls) | |||
489 | 470 | ||
490 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 471 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
491 | plugin->insert_historic_denom_revenue (plugin->cls, | 472 | plugin->insert_historic_denom_revenue (plugin->cls, |
492 | session, | ||
493 | &master_pub, | 473 | &master_pub, |
494 | &rnd_hash, | 474 | &rnd_hash, |
495 | now, | 475 | now, |
@@ -534,7 +514,6 @@ run (void *cls) | |||
534 | 514 | ||
535 | FAILIF (0 >= | 515 | FAILIF (0 >= |
536 | plugin->select_historic_denom_revenue (plugin->cls, | 516 | plugin->select_historic_denom_revenue (plugin->cls, |
537 | session, | ||
538 | &master_pub, | 517 | &master_pub, |
539 | & | 518 | & |
540 | select_historic_denom_revenue_result, | 519 | select_historic_denom_revenue_result, |
@@ -550,7 +529,6 @@ run (void *cls) | |||
550 | 529 | ||
551 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 530 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
552 | plugin->insert_historic_reserve_revenue (plugin->cls, | 531 | plugin->insert_historic_reserve_revenue (plugin->cls, |
553 | session, | ||
554 | &master_pub, | 532 | &master_pub, |
555 | past, | 533 | past, |
556 | future, | 534 | future, |
@@ -558,7 +536,6 @@ run (void *cls) | |||
558 | 536 | ||
559 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 537 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
560 | plugin->insert_historic_reserve_revenue (plugin->cls, | 538 | plugin->insert_historic_reserve_revenue (plugin->cls, |
561 | session, | ||
562 | &master_pub, | 539 | &master_pub, |
563 | now, | 540 | now, |
564 | future, | 541 | future, |
@@ -598,7 +575,6 @@ run (void *cls) | |||
598 | 575 | ||
599 | FAILIF (0 >= | 576 | FAILIF (0 >= |
600 | plugin->select_historic_reserve_revenue (plugin->cls, | 577 | plugin->select_historic_reserve_revenue (plugin->cls, |
601 | session, | ||
602 | &master_pub, | 578 | &master_pub, |
603 | select_historic_reserve_revenue_result, | 579 | select_historic_reserve_revenue_result, |
604 | NULL)); | 580 | NULL)); |
@@ -608,7 +584,6 @@ run (void *cls) | |||
608 | 584 | ||
609 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 585 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
610 | plugin->insert_predicted_result (plugin->cls, | 586 | plugin->insert_predicted_result (plugin->cls, |
611 | session, | ||
612 | &master_pub, | 587 | &master_pub, |
613 | &rbalance)); | 588 | &rbalance)); |
614 | 589 | ||
@@ -621,18 +596,15 @@ run (void *cls) | |||
621 | 596 | ||
622 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 597 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
623 | plugin->update_predicted_result (plugin->cls, | 598 | plugin->update_predicted_result (plugin->cls, |
624 | session, | ||
625 | &master_pub, | 599 | &master_pub, |
626 | &rbalance)); | 600 | &rbalance)); |
627 | 601 | ||
628 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 602 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
629 | plugin->insert_wire_fee_summary (plugin->cls, | 603 | plugin->insert_wire_fee_summary (plugin->cls, |
630 | session, | ||
631 | &master_pub, | 604 | &master_pub, |
632 | &rbalance)); | 605 | &rbalance)); |
633 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 606 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
634 | plugin->update_wire_fee_summary (plugin->cls, | 607 | plugin->update_wire_fee_summary (plugin->cls, |
635 | session, | ||
636 | &master_pub, | 608 | &master_pub, |
637 | &reserve_profits)); | 609 | &reserve_profits)); |
638 | { | 610 | { |
@@ -640,7 +612,6 @@ run (void *cls) | |||
640 | 612 | ||
641 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 613 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
642 | plugin->get_wire_fee_summary (plugin->cls, | 614 | plugin->get_wire_fee_summary (plugin->cls, |
643 | session, | ||
644 | &master_pub, | 615 | &master_pub, |
645 | &rprof)); | 616 | &rprof)); |
646 | FAILIF (0 != | 617 | FAILIF (0 != |
@@ -648,34 +619,29 @@ run (void *cls) | |||
648 | &reserve_profits)); | 619 | &reserve_profits)); |
649 | } | 620 | } |
650 | FAILIF (0 > | 621 | FAILIF (0 > |
651 | plugin->commit (plugin->cls, | 622 | plugin->commit (plugin->cls)); |
652 | session)); | ||
653 | 623 | ||
654 | 624 | ||
655 | FAILIF (GNUNET_OK != | 625 | FAILIF (GNUNET_OK != |
656 | plugin->start (plugin->cls, | 626 | plugin->start (plugin->cls)); |
657 | session)); | ||
658 | 627 | ||
659 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 628 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
660 | "Test: get_predicted_balance\n"); | 629 | "Test: get_predicted_balance\n"); |
661 | 630 | ||
662 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 631 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
663 | plugin->get_predicted_balance (plugin->cls, | 632 | plugin->get_predicted_balance (plugin->cls, |
664 | session, | ||
665 | &master_pub, | 633 | &master_pub, |
666 | &rbalance2)); | 634 | &rbalance2)); |
667 | 635 | ||
668 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 636 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
669 | plugin->del_reserve_info (plugin->cls, | 637 | plugin->del_reserve_info (plugin->cls, |
670 | session, | ||
671 | &reserve_pub, | 638 | &reserve_pub, |
672 | &master_pub)); | 639 | &master_pub)); |
673 | 640 | ||
674 | FAILIF (0 != TALER_amount_cmp (&rbalance2, | 641 | FAILIF (0 != TALER_amount_cmp (&rbalance2, |
675 | &rbalance)); | 642 | &rbalance)); |
676 | 643 | ||
677 | plugin->rollback (plugin->cls, | 644 | plugin->rollback (plugin->cls); |
678 | session); | ||
679 | 645 | ||
680 | #if GC_IMPLEMENTED | 646 | #if GC_IMPLEMENTED |
681 | FAILIF (GNUNET_OK != | 647 | FAILIF (GNUNET_OK != |
@@ -685,22 +651,17 @@ run (void *cls) | |||
685 | result = 0; | 651 | result = 0; |
686 | 652 | ||
687 | drop: | 653 | drop: |
688 | if (NULL != session) | ||
689 | { | 654 | { |
690 | plugin->rollback (plugin->cls, | 655 | plugin->rollback (plugin->cls); |
691 | session); | ||
692 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 656 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
693 | "Test: auditor_delete_exchange\n"); | 657 | "Test: auditor_delete_exchange\n"); |
694 | GNUNET_break (GNUNET_OK == | 658 | GNUNET_break (GNUNET_OK == |
695 | plugin->start (plugin->cls, | 659 | plugin->start (plugin->cls)); |
696 | session)); | ||
697 | GNUNET_break (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == | 660 | GNUNET_break (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == |
698 | plugin->delete_exchange (plugin->cls, | 661 | plugin->delete_exchange (plugin->cls, |
699 | session, | ||
700 | &master_pub)); | 662 | &master_pub)); |
701 | GNUNET_break (0 <= | 663 | GNUNET_break (0 <= |
702 | plugin->commit (plugin->cls, | 664 | plugin->commit (plugin->cls)); |
703 | session)); | ||
704 | } | 665 | } |
705 | GNUNET_break (GNUNET_OK == | 666 | GNUNET_break (GNUNET_OK == |
706 | plugin->drop_tables (plugin->cls, | 667 | plugin->drop_tables (plugin->cls, |