split config files, towards making pybank test case work again

This commit is contained in:
Florian Dold 2020-01-17 12:15:57 +01:00
parent 21afdac1f3
commit 099884ee66
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B
5 changed files with 60 additions and 28 deletions

View File

@ -33,7 +33,8 @@
#include <microhttpd.h> #include <microhttpd.h>
#include "taler_testing_lib.h" #include "taler_testing_lib.h"
#define CONFIG_FILE "test_bank_api.conf" #define CONFIG_FILE_FAKEBANK "test_bank_api_fakebank.conf"
#define CONFIG_FILE_PYBANK "test_bank_api_pybank.conf"
/** /**
* Bank configuration data. * Bank configuration data.
@ -126,6 +127,7 @@ main (int argc,
char *const *argv) char *const *argv)
{ {
int rv; int rv;
const char *cfgfilename;
/* These environment variables get in the way... */ /* These environment variables get in the way... */
unsetenv ("XDG_DATA_HOME"); unsetenv ("XDG_DATA_HOME");
@ -138,8 +140,9 @@ main (int argc,
if (GNUNET_YES == with_fakebank) if (GNUNET_YES == with_fakebank)
{ {
TALER_LOG_DEBUG ("Running against the Fakebank.\n"); TALER_LOG_DEBUG ("Running against the Fakebank.\n");
cfgfilename = CONFIG_FILE_FAKEBANK;
if (GNUNET_OK != if (GNUNET_OK !=
TALER_TESTING_prepare_fakebank (CONFIG_FILE, TALER_TESTING_prepare_fakebank (CONFIG_FILE_FAKEBANK,
"account-2", "account-2",
&bc)) &bc))
{ {
@ -150,15 +153,16 @@ main (int argc,
else else
{ {
TALER_LOG_DEBUG ("Running against the Pybank.\n"); TALER_LOG_DEBUG ("Running against the Pybank.\n");
cfgfilename = CONFIG_FILE_PYBANK;
if (GNUNET_OK != if (GNUNET_OK !=
TALER_TESTING_prepare_bank (CONFIG_FILE, TALER_TESTING_prepare_bank (CONFIG_FILE_PYBANK,
&bc)) &bc))
{ {
GNUNET_break (0); GNUNET_break (0);
return 77; return 77;
} }
if (NULL == (bankd = TALER_TESTING_run_bank (CONFIG_FILE, if (NULL == (bankd = TALER_TESTING_run_bank (CONFIG_FILE_PYBANK,
bc.bank_url))) bc.bank_url)))
{ {
GNUNET_break (0); GNUNET_break (0);
@ -168,7 +172,7 @@ main (int argc,
rv = (GNUNET_OK == TALER_TESTING_setup (&run, rv = (GNUNET_OK == TALER_TESTING_setup (&run,
NULL, NULL,
CONFIG_FILE, cfgfilename,
NULL, NULL,
GNUNET_NO)) ? 0 : 1; GNUNET_NO)) ? 0 : 1;
if (GNUNET_NO == with_fakebank) if (GNUNET_NO == with_fakebank)

View File

@ -1,10 +0,0 @@
[taler]
currency = KUDOS
[account-2]
URL = payto://x-taler-bank/localhost/2
[bank]
SERVE = http
HTTP_PORT = 8081
DATABASE = postgres:///talercheck

View File

@ -0,0 +1,17 @@
# This file is in the public domain.
[taler]
currency = KUDOS
[account-2]
URL = payto://x-taler-bank/localhost/2
METHOD = x-taler-bank
WIRE_GATEWAY_URL = "http://localhost:8081/2/"
WIRE_GATEWAY_AUTH_METHOD = basic
USERNAME = Exchange
PASSWORD = x
[bank]
SERVE = http
HTTP_PORT = 8081
DATABASE = postgres:///talercheck

View File

@ -0,0 +1,17 @@
# This file is in the public domain.
[taler]
currency = KUDOS
[account-2]
URL = payto://x-taler-bank/localhost/2
METHOD = x-taler-bank
WIRE_GATEWAY_URL = "http://localhost:8081/2/"
WIRE_GATEWAY_AUTH_METHOD = basic
USERNAME = Exchange
PASSWORD = x
[bank]
SERVE = http
HTTP_PORT = 8081
DATABASE = postgres:///talercheck

View File

@ -187,7 +187,7 @@ TALER_TESTING_run_bank (const char *config_filename,
/* give child time to start and bind against the socket */ /* give child time to start and bind against the socket */
fprintf (stderr, fprintf (stderr,
"Waiting for `taler-bank-manage' to be ready"); "Waiting for `taler-bank-manage' to be ready (via %s)\n", wget_cmd);
iter = 0; iter = 0;
do do
{ {
@ -348,17 +348,21 @@ TALER_TESTING_prepare_bank (const char *config_filename,
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
GNUNET_CONFIGURATION_destroy (cfg); GNUNET_CONFIGURATION_destroy (cfg);
GNUNET_asprintf (&bc->bank_url, bc->bank_url = GNUNET_strdup (bc->exchange_auth.wire_gateway_url);
"http://localhost:%llu/", bc->exchange_account_url = GNUNET_strdup (bc->exchange_auth.wire_gateway_url);
port); bc->exchange_payto = "payto://x-taler-bank/localhost/2";
GNUNET_asprintf (&bc->exchange_account_url, bc->user42_payto = "payto://x-taler-bank/localhost/42";
"%s%s", bc->user43_payto = "payto://x-taler-bank/localhost/43";
bc->bank_url, GNUNET_log (GNUNET_ERROR_TYPE_INFO,
EXCHANGE_ACCOUNT_NAME); "Using pybank %s on port %u\n",
bc->exchange_payto = TALER_payto_xtalerbank_make (bc->bank_url, bc->exchange_auth.wire_gateway_url,
EXCHANGE_ACCOUNT_NAME); (unsigned int) port);
bc->user42_payto = TALER_payto_xtalerbank_make (bc->bank_url, "42"); GNUNET_log (GNUNET_ERROR_TYPE_INFO, "exchange payto: %s\n",
bc->user43_payto = TALER_payto_xtalerbank_make (bc->bank_url, "43"); bc->exchange_payto);
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "user42_payto: %s\n",
bc->user42_payto);
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "user42_payto: %s\n",
bc->user43_payto);
return GNUNET_OK; return GNUNET_OK;
} }
@ -413,7 +417,7 @@ TALER_TESTING_prepare_fakebank (const char *config_filename,
(unsigned int) fakebank_port); (unsigned int) fakebank_port);
GNUNET_CONFIGURATION_destroy (cfg); GNUNET_CONFIGURATION_destroy (cfg);
bc->bank_url = bc->exchange_auth.wire_gateway_url; bc->bank_url = GNUNET_strdup (bc->exchange_auth.wire_gateway_url);
if (GNUNET_OK != if (GNUNET_OK !=
TALER_TESTING_url_port_free (bc->bank_url)) TALER_TESTING_url_port_free (bc->bank_url))
{ {