summaryrefslogtreecommitdiff
path: root/src/testing
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-03-15 00:36:15 +0100
committerChristian Grothoff <christian@grothoff.org>2020-03-15 00:36:15 +0100
commitf8095d7297a9a02797a51eea494c5cdc5f8c5ffa (patch)
tree726ba4374ef4cd873caf5a10e7e6b1d5753d6f31 /src/testing
parentb3a52548fd3eff29f17c8b1f6329dc97b24b8502 (diff)
downloadexchange-f8095d7297a9a02797a51eea494c5cdc5f8c5ffa.tar.gz
exchange-f8095d7297a9a02797a51eea494c5cdc5f8c5ffa.tar.bz2
exchange-f8095d7297a9a02797a51eea494c5cdc5f8c5ffa.zip
fix shutdown logic of test
Diffstat (limited to 'src/testing')
-rw-r--r--src/testing/test_taler_exchange_aggregator.c32
1 files 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
@@ -72,6 +72,24 @@ static char *config_filename;
/**
+ * 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.
*/
static void
@@ -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;
}