donau

Donation authority for GNU Taler (experimental)
Log | Files | Refs | Submodules | README | LICENSE

commit 41854644ec2dcd21811c04be1f8e8a1e6ea2ae5e
parent f0426eae184cea17d8076bc5f2cd9160123f2046
Author: Matyja Lukas Adam <lukas.matyja@students.bfh.ch>
Date:   Tue,  9 Apr 2024 00:19:26 +0200

Merge remote-tracking branch 'refs/remotes/origin/master'

Diffstat:
Msrc/donau/donau-httpd_get-charities.c | 1-
Msrc/donaudb/plugin_donaudb_postgres.c | 10----------
Msrc/donaudb/test-donau-db-postgres.conf | 1+
Msrc/donaudb/test_donaudb.c | 42++++++++++++++++++++++++++++++++++++++++++
Asrc/donaudb/test_idempotency.sh | 12++++++++++++
Msrc/lib/Makefile.am | 7-------
Msrc/util/Makefile.am | 15---------------
7 files changed, 55 insertions(+), 33 deletions(-)

diff --git a/src/donau/donau-httpd_get-charities.c b/src/donau/donau-httpd_get-charities.c @@ -28,7 +28,6 @@ #include "donau-httpd.h" #include "donaudb_plugin.h" #include "donau-httpd_charity.h" -// #include <taler-exchange-httpd_metrics.h> /** diff --git a/src/donaudb/plugin_donaudb_postgres.c b/src/donaudb/plugin_donaudb_postgres.c @@ -39,16 +39,6 @@ #include "pg_event_listen.h" #include "pg_event_listen_cancel.h" #include "pg_event_notify.h" -// #include "pg_get_policy_details.h" -// #include "pg_persist_policy_details.h" -// #include "pg_gc.h" -// #include "pg_begin_shard.h" -// #include "pg_abort_shard.h" -// #include "pg_complete_shard.h" -// #include "pg_release_revolving_shard.h" -// #include "pg_delete_shard_locks.h" -// #include "pg_compute_shard.h" - #include "pg_insert_donation_unit.h" #include "pg_iterate_donation_units.h" #include "pg_insert_history_entry.h" diff --git a/src/donaudb/test-donau-db-postgres.conf b/src/donaudb/test-donau-db-postgres.conf @@ -4,6 +4,7 @@ DB = postgres BASE_URL = http://localhost/ + [donaudb-postgres] #The connection string the plugin has to use for connecting to the database diff --git a/src/donaudb/test_donaudb.c b/src/donaudb/test_donaudb.c @@ -65,6 +65,48 @@ static int result; */ static struct DONAUDB_Plugin *plugin; + +/** + * Main function that will be run by the scheduler. + * + * @param cls closure with config + */ +static void +run (void *cls) +{ + struct GNUNET_CONFIGURATION_Handle *cfg = cls; + + if (NULL == + (plugin = DONAUDB_plugin_load (cfg))) + { + result = 77; + return; + } + (void) plugin->drop_tables (plugin->cls); + if (GNUNET_OK != + plugin->create_tables (plugin->cls)) + { + result = 77; + goto cleanup; + } + plugin->preflight (plugin->cls); + FAILIF (GNUNET_OK != + plugin->start (plugin->cls, + "test-1")); + +// TODO Add tests + +drop: + if (0 != result) + plugin->rollback (plugin->cls); + GNUNET_break (GNUNET_OK == + plugin->drop_tables (plugin->cls)); +cleanup: + DONAUDB_plugin_unload (plugin); + plugin = NULL; +} + + int main (int argc, char *const argv[]) diff --git a/src/donaudb/test_idempotency.sh b/src/donaudb/test_idempotency.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# This file is in the public domain. +set -eu +psql donaucheck < /dev/null || exit 77 +echo "Initializing DB" +donau-dbinit -r -c test-donau-db-postgres.conf +echo "Re-initializing DB" +donau-dbinit -c test-donau-db-postgres.conf +echo "Re-loading procedures" +psql donaucheck < procedures.sql +echo "Test PASSED" +exit 0 diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am @@ -41,10 +41,3 @@ libdonau_la_LIBADD = \ $(LIBGNURLCURL_LIBS) \ $(XLIB) -.NOTPARALLEL: -check_PROGRAMS = \ - test_donau_api_cs \ - test_donau_api_rsa - -TESTS = \ - $(check_PROGRAMS) diff --git a/src/util/Makefile.am b/src/util/Makefile.am @@ -60,18 +60,3 @@ libdonauutil_la_LDFLAGS = \ -version-info 0:0:0 \ -no-undefined -AM_TESTS_ENVIRONMENT=export TALER_PREFIX=$${TALER_PREFIX:-@libdir@};export PATH=$${TALER_PREFIX:-@prefix@}/bin:$$PATH; - -check_PROGRAMS = \ - test_crypto - -TESTS = \ - $(check_PROGRAMS) - -test_crypto_SOURCES = \ - test_crypto.c -test_crypto_LDADD = \ - libdonauutil.la \ - -ltalerutil \ - -lgnunetutil -