commit 2a70ca5ebe860558f7ec338be6d50655a63c4de1
parent e0070070910767c856452884b106cfd2fc5fbf0d
Author: Casaburi Johannes <johannes.casaburi@students.bfh.ch>
Date: Mon, 8 Apr 2024 22:53:53 +0200
fixing tests
Diffstat:
6 files changed, 44 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,8 @@ DB = postgres
BASE_URL = http://localhost/
+CURRENCY = EUR
+
[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/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
-