[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-exchange] 03/04: fix shutdown logic of test
From: |
gnunet |
Subject: |
[taler-exchange] 03/04: fix shutdown logic of test |
Date: |
Sun, 15 Mar 2020 00:56:03 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository exchange.
commit f8095d7297a9a02797a51eea494c5cdc5f8c5ffa
Author: Christian Grothoff <address@hidden>
AuthorDate: Sun Mar 15 00:36:15 2020 +0100
fix shutdown logic of test
---
src/testing/test_taler_exchange_aggregator.c | 32 +++++++++++++++++++++-------
1 file changed, 24 insertions(+), 8 deletions(-)
diff --git a/src/testing/test_taler_exchange_aggregator.c
b/src/testing/test_taler_exchange_aggregator.c
index 66cdecff..fe96d635 100644
--- a/src/testing/test_taler_exchange_aggregator.c
+++ b/src/testing/test_taler_exchange_aggregator.c
@@ -71,6 +71,24 @@ static char *config_filename;
TALER_TESTING_cmd_exec_transfer (label "-transfer", cfg_fn)
+/**
+ * Function run on shutdown to unload the DB plugin.
+ *
+ * @param cls NULL
+ */
+static void
+unload_db (void *cls)
+{
+ (void) cls;
+ if (NULL != dbc.plugin)
+ {
+ dbc.plugin->drop_tables (dbc.plugin->cls);
+ TALER_EXCHANGEDB_plugin_unload (dbc.plugin);
+ dbc.plugin = NULL;
+ }
+}
+
+
/**
* Collects all the tests.
*/
@@ -431,6 +449,8 @@ run (void *cls,
TALER_TESTING_cmd_end ()
};
+ GNUNET_SCHEDULER_add_shutdown (&unload_db,
+ NULL);
TALER_TESTING_run_with_fakebank (is,
all,
bc.exchange_auth.wire_gateway_url);
@@ -473,8 +493,6 @@ prepare_database (void *cls,
cfg,
NULL, // no exchange process handle.
GNUNET_NO); // do not try to connect to the
exchange
-
-
return GNUNET_OK;
}
@@ -524,18 +542,16 @@ main (int argc,
return 77;
}
- if (GNUNET_OK != GNUNET_CONFIGURATION_parse_and_run (config_filename,
- &prepare_database,
- NULL))
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_parse_and_run (config_filename,
+ &prepare_database,
+ NULL))
{
TALER_LOG_WARNING ("Could not prepare database for tests.\n");
return result;
}
-
GNUNET_free (config_filename);
GNUNET_free (testname);
- dbc.plugin->drop_tables (dbc.plugin->cls);
- TALER_EXCHANGEDB_plugin_unload (dbc.plugin);
return GNUNET_OK == result ? 0 : 1;
}
--
To stop receiving notification emails like this one, please contact
address@hidden.