fix bank-lib ftbfs

This commit is contained in:
Christian Grothoff 2020-01-12 17:43:20 +01:00
parent 9b586cd5f0
commit 00740610ba
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
3 changed files with 58 additions and 38 deletions

@ -1 +1 @@
Subproject commit ca53235ccfa0458ebf11c204888ca370e20ec3f5 Subproject commit 934a6a18301e81c4fd1b3a8cda2dc13dca4741cc

View File

@ -57,11 +57,16 @@ static char *payto_url;
*/ */
static struct GNUNET_OS_Process *bankd; static struct GNUNET_OS_Process *bankd;
/**
* Authentication data to use.
*/
static struct TALER_BANK_AuthenticationData auth;
/** /**
* Flag indicating whether the test is running against the * Flag indicating whether the test is running against the
* Fakebank. Set up at runtime. * Fakebank. Set up at runtime.
*/ */
static int WITH_FAKEBANK; static int with_fakebank;
/** /**
* Main function that will tell the interpreter what commands to * Main function that will tell the interpreter what commands to
@ -73,55 +78,62 @@ static void
run (void *cls, run (void *cls,
struct TALER_TESTING_Interpreter *is) struct TALER_TESTING_Interpreter *is)
{ {
struct TALER_WireTransferIdentifierRawP wtid;
struct TALER_TESTING_Command commands[] = { struct TALER_TESTING_Command commands[] = {
TALER_TESTING_cmd_bank_credits ("history-0", TALER_TESTING_cmd_bank_credits ("history-0",
account_url, account_url,
&auth,
NULL, NULL,
1), 1),
TALER_TESTING_cmd_fakebank_transfer ("debit-1", TALER_TESTING_cmd_admin_add_incoming ("debit-1",
"KUDOS:5.01", "KUDOS:5.01",
account_url, account_url,
payto_url, &auth,
NULL, payto_url),
NULL),
TALER_TESTING_cmd_bank_credits ("history-1c", TALER_TESTING_cmd_bank_credits ("history-1c",
account_url, account_url,
&auth,
NULL, NULL,
5), 5),
TALER_TESTING_cmd_bank_debits ("history-1d", TALER_TESTING_cmd_bank_debits ("history-1d",
account_url, account_url,
&auth,
NULL, NULL,
5), 5),
TALER_TESTING_cmd_fakebank_transfer ("debit-2", TALER_TESTING_cmd_admin_add_incoming ("debit-2",
"KUDOS:3.21", "KUDOS:3.21",
account_url, account_url,
payto_url, &auth,
NULL, payto_url),
NULL), TALER_TESTING_cmd_transfer ("credit-2",
TRANSFER ("credit-2", "KUDOS:3.22",
"KUDOS:3.22", account_url,
TALER_TESTING_USER_ACCOUNT_NUMBER, &auth,
TALER_TESTING_EXCHANGE_ACCOUNT_NUMBER, payto_url,
"credit 2"), &wtid,
"http://exchange.example.com/"),
TALER_TESTING_cmd_bank_debits ("history-2b", TALER_TESTING_cmd_bank_debits ("history-2b",
account_url, account_url,
&auth,
NULL, NULL,
5), 5),
TALER_TESTING_cmd_end () TALER_TESTING_cmd_end ()
}; };
memset (&wtid, 42, sizeof (wtid));
GNUNET_log (GNUNET_ERROR_TYPE_INFO, GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Bank serves at `%s'\n", "Bank serves at `%s'\n",
bank_url); bank_url);
GNUNET_asprintf (&account_url, GNUNET_asprintf (&account_url,
"%s/%s", "%s/%s",
base_url, bank_url,
"alice"); "alice");
GNUNET_asprintf (&payto_url, GNUNET_asprintf (&payto_url,
"payto://x-taler-bank/%s/%s", "payto://x-taler-bank/%s/%s",
base_url, bank_url,
"bob"); "bob");
if (GNUNET_YES == WITH_FAKEBANK) // FIXME: init 'auth'!
if (GNUNET_YES == with_fakebank)
TALER_TESTING_run_with_fakebank (is, TALER_TESTING_run_with_fakebank (is,
commands, commands,
bank_url); bank_url);
@ -144,9 +156,9 @@ main (int argc,
"DEBUG", "DEBUG",
NULL); NULL);
WITH_FAKEBANK = TALER_TESTING_has_in_name (argv[0], with_fakebank = TALER_TESTING_has_in_name (argv[0],
"_with_fakebank"); "_with_fakebank");
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");
if (NULL == (bank_url = TALER_TESTING_prepare_fakebank (CONFIG_FILE, if (NULL == (bank_url = TALER_TESTING_prepare_fakebank (CONFIG_FILE,
@ -178,7 +190,7 @@ main (int argc,
CONFIG_FILE, CONFIG_FILE,
NULL, NULL,
GNUNET_NO)) ? 0 : 1; GNUNET_NO)) ? 0 : 1;
if (GNUNET_NO == WITH_FAKEBANK) if (GNUNET_NO == with_fakebank)
{ {
GNUNET_OS_process_kill (bankd, GNUNET_OS_process_kill (bankd,

View File

@ -45,7 +45,7 @@
/** /**
* True when the test runs against Fakebank. * True when the test runs against Fakebank.
*/ */
static int WITH_FAKEBANK; static int with_fakebank;
/** /**
* (real) Twister URL. Used at startup time to check if it runs. * (real) Twister URL. Used at startup time to check if it runs.
@ -53,10 +53,15 @@ static int WITH_FAKEBANK;
static char *twister_url; static char *twister_url;
/** /**
* URL of the twister where all the connections to the * Account URL of the twister where all the connections to the
* bank that have to be proxied should be addressed to. * bank that have to be proxied should be addressed to.
*/ */
#define TWISTED_BANK_URL twister_url static char *twisted_account_url;
/**
* Authentication data to use.
*/
static struct TALER_BANK_AuthenticationData auth;
/** /**
* URL of the bank. * URL of the bank.
@ -90,18 +95,21 @@ run (void *cls,
* fakebank runs inside the same process of the test. * fakebank runs inside the same process of the test.
*/ */
TALER_TESTING_cmd_wait_service ("wait-service", TALER_TESTING_cmd_wait_service ("wait-service",
TWISTED_BANK_URL), twister_url),
TALER_TESTING_cmd_bank_history ("history-0", TALER_TESTING_cmd_bank_credits ("history-0",
TWISTED_BANK_URL, twisted_account_url,
TALER_TESTING_EXCHANGE_ACCOUNT_NUMBER, &auth,
TALER_BANK_DIRECTION_BOTH,
GNUNET_NO,
NULL, NULL,
5), 5),
TALER_TESTING_cmd_end () TALER_TESTING_cmd_end ()
}; };
if (GNUNET_YES == WITH_FAKEBANK) GNUNET_asprintf (&twisted_account_url,
"%s/%s",
twister_url,
"alice");
// FIXME: init 'auth'!
if (GNUNET_YES == with_fakebank)
TALER_TESTING_run_with_fakebank (is, TALER_TESTING_run_with_fakebank (is,
commands, commands,
bank_url); bank_url);
@ -150,10 +158,10 @@ main (int argc,
return 77; return 77;
} }
WITH_FAKEBANK = TALER_TESTING_has_in_name (argv[0], with_fakebank = TALER_TESTING_has_in_name (argv[0],
"_with_fakebank"); "_with_fakebank");
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");
if (NULL == (bank_url = TALER_TESTING_prepare_fakebank if (NULL == (bank_url = TALER_TESTING_prepare_fakebank
@ -193,7 +201,7 @@ main (int argc,
GNUNET_NO); GNUNET_NO);
purge_process (twisterd); purge_process (twisterd);
if (GNUNET_NO == WITH_FAKEBANK) if (GNUNET_NO == with_fakebank)
{ {
GNUNET_OS_process_kill (bankd, GNUNET_OS_process_kill (bankd,
SIGKILL); SIGKILL);