summaryrefslogtreecommitdiff
path: root/src/bank-lib/testing_api_helpers.c
diff options
context:
space:
mode:
authorMarcello Stanisci <stanisci.m@gmail.com>2018-05-29 10:27:41 +0200
committerMarcello Stanisci <stanisci.m@gmail.com>2018-05-29 10:27:41 +0200
commit5faa541d270fa6664a6b61b67c36dce48b368356 (patch)
tree76301bfae6ccdbb0ab00844133e1cbf0225fcd8d /src/bank-lib/testing_api_helpers.c
parent42dcf052d1283849ce2fa6f9a9504f64021c44f4 (diff)
downloadexchange-5faa541d270fa6664a6b61b67c36dce48b368356.tar.gz
exchange-5faa541d270fa6664a6b61b67c36dce48b368356.tar.bz2
exchange-5faa541d270fa6664a6b61b67c36dce48b368356.zip
do not use hard coded database string
Diffstat (limited to 'src/bank-lib/testing_api_helpers.c')
-rw-r--r--src/bank-lib/testing_api_helpers.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/bank-lib/testing_api_helpers.c b/src/bank-lib/testing_api_helpers.c
index d890ea4eb..cc6bf412d 100644
--- a/src/bank-lib/testing_api_helpers.c
+++ b/src/bank-lib/testing_api_helpers.c
@@ -27,7 +27,8 @@
#include <gnunet/gnunet_util_lib.h>
#include "taler_testing_bank_lib.h"
-/* Keeps each bank account credential at bank account number - 1 */
+/* Keep each bank account credentials at index:
+ * bank account number - 1 */
struct TALER_BANK_AuthenticationData AUTHS[] = {
/* Bank credentials */
@@ -52,6 +53,8 @@ struct TALER_BANK_AuthenticationData AUTHS[] = {
* bank" function to do such tasks.
*
* @param config_filename configuration filename.
+ * @param bank_url base URL of the bank, used by `wget' to check
+ * that the bank was started right.
*
* @return the process, or NULL if the process could not
* be started.
@@ -60,10 +63,6 @@ struct GNUNET_OS_Process *
TALER_TESTING_run_bank (const char *config_filename,
const char *bank_url)
{
-
- /* to fetch: dbname+serving_method+base_url */
-
-
struct GNUNET_OS_Process *bank_proc;
unsigned int iter;
char *wget_cmd;
@@ -160,9 +159,10 @@ TALER_TESTING_run_bank (const char *config_filename,
}
+
/**
* Prepare the bank execution. Check if the port is available
- * (and reset database?).
+ * and reset database.
*
* @param config_filename configuration filename.
*
@@ -178,6 +178,7 @@ TALER_TESTING_prepare_bank (const char *config_filename)
enum GNUNET_OS_ProcessStatusType type;
unsigned long code;
char *base_url;
+ char *database;
cfg = GNUNET_CONFIGURATION_create ();
@@ -185,6 +186,16 @@ TALER_TESTING_prepare_bank (const char *config_filename)
(cfg, config_filename))
BANK_FAIL ();
+ if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string
+ (cfg, "bank", "DATABASE", &database))
+ {
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ "bank",
+ "DATABASE");
+ GNUNET_CONFIGURATION_destroy (cfg);
+ BANK_FAIL ();
+ }
+
if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number
(cfg, "bank", "HTTP_PORT", &port))
{
@@ -214,7 +225,7 @@ TALER_TESTING_prepare_bank (const char *config_filename)
"taler-bank-manage",
"taler-bank-manage",
"-c", "bank.conf",
- "--with-db=postgres:///talercheck", /*FIXME: no hardcoded*/
+ "--with-db", database, /*FIXME: no hardcoded*/
"django",
"flush",
"--no-input", NULL)))