From 4f713b40e3571fef9f29fa8c16043a9dd7d8b841 Mon Sep 17 00:00:00 2001 From: Marcello Stanisci Date: Fri, 17 Apr 2020 00:32:18 +0200 Subject: Prepare and launch Nexus for tests. --- src/testing/test_bank_api.c | 47 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 39 insertions(+), 8 deletions(-) (limited to 'src/testing/test_bank_api.c') diff --git a/src/testing/test_bank_api.c b/src/testing/test_bank_api.c index b0b61a16..9d182f29 100644 --- a/src/testing/test_bank_api.c +++ b/src/testing/test_bank_api.c @@ -35,6 +35,7 @@ #define CONFIG_FILE_FAKEBANK "test_bank_api_fakebank.conf" #define CONFIG_FILE_PYBANK "test_bank_api_pybank.conf" +#define CONFIG_FILE_NEXUS "test_bank_api_nexus.conf" /** * Bank configuration data. @@ -141,8 +142,8 @@ int main (int argc, char *const *argv) { - const char *cfgfilename; int rv; + const char *cfgfile; /* These environment variables get in the way... */ unsetenv ("XDG_DATA_HOME"); @@ -150,12 +151,12 @@ main (int argc, GNUNET_log_setup ("test-bank-api", "DEBUG", NULL); - with_fakebank = TALER_TESTING_has_in_name (argv[0], - "_with_fakebank"); - if (GNUNET_YES == with_fakebank) + + if (GNUNET_YES == TALER_TESTING_has_in_name (argv[0], + "_with_fakebank")) { TALER_LOG_DEBUG ("Running against the Fakebank.\n"); - cfgfilename = CONFIG_FILE_FAKEBANK; + cfgfile = CONFIG_FILE_FAKEBANK; if (GNUNET_OK != TALER_TESTING_prepare_fakebank (CONFIG_FILE_FAKEBANK, "exchange-account-2", @@ -165,10 +166,11 @@ main (int argc, return 77; } } - else + else if (GNUNET_YES == TALER_TESTING_has_in_name (argv[0], + "_with_pybank")) { TALER_LOG_DEBUG ("Running against the Pybank.\n"); - cfgfilename = CONFIG_FILE_PYBANK; + cfgfile = CONFIG_FILE_FAKEBANK; if (GNUNET_OK != TALER_TESTING_prepare_bank (CONFIG_FILE_PYBANK, GNUNET_YES, @@ -186,9 +188,38 @@ main (int argc, GNUNET_break (0); return 77; } + } else if (GNUNET_YES == TALER_TESTING_has_in_name (argv[0], + "_with_nexus")) + { + TALER_LOG_DEBUG ("Running against Nexus.\n"); + cfgfile = CONFIG_FILE_FAKEBANK; + if (GNUNET_OK != TALER_TESTING_prepare_nexus (CONFIG_FILE_NEXUS, + GNUNET_YES, + "exchange-account-2", + &bc)) + { + GNUNET_break (0); + return 77; + } + if (NULL == (bankd = TALER_TESTING_run_nexus (&bc))) + { + GNUNET_break (0); + return 77; + } + GNUNET_OS_process_kill (bankd, + SIGKILL); + GNUNET_OS_process_wait (bankd); + GNUNET_OS_process_destroy (bankd); + return 99; } + else + { + GNUNET_break (0); + return 77; + } + if (GNUNET_OK != - GNUNET_CONFIGURATION_parse_and_run (cfgfilename, + GNUNET_CONFIGURATION_parse_and_run (cfgfile, &setup_with_cfg, NULL)) rv = 1; -- cgit v1.2.3 From 04d4922d71a60a8a281e577bf569fd52f612ae57 Mon Sep 17 00:00:00 2001 From: Marcello Stanisci Date: Fri, 17 Apr 2020 13:45:03 +0200 Subject: fix nexus-test return code Returning zero, so as not to block the 'make check' experience. This is useful to check whether nexus-related changes broke tests in a different place. --- src/testing/Makefile.am | 1 + src/testing/test_bank_api.c | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src/testing/test_bank_api.c') diff --git a/src/testing/Makefile.am b/src/testing/Makefile.am index 922213da..d73e89b3 100644 --- a/src/testing/Makefile.am +++ b/src/testing/Makefile.am @@ -118,6 +118,7 @@ check_PROGRAMS = \ test_auditor_api_version \ test_bank_api_with_fakebank \ test_bank_api_with_pybank \ + test_bank_api_with_nexus \ test_exchange_api \ test_exchange_api_keys_cherry_picking \ test_exchange_api_revocation \ diff --git a/src/testing/test_bank_api.c b/src/testing/test_bank_api.c index 9d182f29..2a709fb1 100644 --- a/src/testing/test_bank_api.c +++ b/src/testing/test_bank_api.c @@ -151,9 +151,10 @@ main (int argc, GNUNET_log_setup ("test-bank-api", "DEBUG", NULL); - - if (GNUNET_YES == TALER_TESTING_has_in_name (argv[0], - "_with_fakebank")) + + with_fakebank = TALER_TESTING_has_in_name (argv[0], + "_with_fakebank"); + if (GNUNET_YES == with_fakebank) { TALER_LOG_DEBUG ("Running against the Fakebank.\n"); cfgfile = CONFIG_FILE_FAKEBANK; @@ -210,7 +211,7 @@ main (int argc, SIGKILL); GNUNET_OS_process_wait (bankd); GNUNET_OS_process_destroy (bankd); - return 99; + return 0; } else { -- cgit v1.2.3