add logic to launch crypto helpers as part of tests
This commit is contained in:
parent
06b8ed9ba8
commit
d3184e04e2
@ -14,3 +14,6 @@ PASSWORD = x
|
|||||||
SERVE = http
|
SERVE = http
|
||||||
HTTP_PORT = 8081
|
HTTP_PORT = 8081
|
||||||
DATABASE = postgres:///talercheck
|
DATABASE = postgres:///talercheck
|
||||||
|
|
||||||
|
[auditor]
|
||||||
|
BASE_URL = "http://localhost:8083/"
|
||||||
|
@ -32,3 +32,6 @@ PAYTO_URI = payto://x-taler-bank/localhost:8081/1
|
|||||||
|
|
||||||
[exchange-account-2]
|
[exchange-account-2]
|
||||||
PAYTO_URI = payto://x-taler-bank/localhost:8081/2
|
PAYTO_URI = payto://x-taler-bank/localhost:8081/2
|
||||||
|
|
||||||
|
[auditor]
|
||||||
|
BASE_URL = "http://localhost:8083/"
|
||||||
|
@ -16,4 +16,7 @@ PASSWORD = x
|
|||||||
[bank]
|
[bank]
|
||||||
# not (!) used by the nexus, only by the helper
|
# not (!) used by the nexus, only by the helper
|
||||||
# check to make sure the port is free for the nexus.
|
# check to make sure the port is free for the nexus.
|
||||||
HTTP_PORT = 5001
|
HTTP_PORT = 5001
|
||||||
|
|
||||||
|
[auditor]
|
||||||
|
BASE_URL = "http://localhost:8083/"
|
||||||
|
@ -15,3 +15,6 @@ PASSWORD = x
|
|||||||
SERVE = http
|
SERVE = http
|
||||||
HTTP_PORT = 8081
|
HTTP_PORT = 8081
|
||||||
DATABASE = postgres:///talercheck
|
DATABASE = postgres:///talercheck
|
||||||
|
|
||||||
|
[auditor]
|
||||||
|
BASE_URL = "http://localhost:8083/"
|
||||||
|
@ -19,6 +19,9 @@ UNIX_MATCH_UID = NO
|
|||||||
UNIX_MATCH_GID = YES
|
UNIX_MATCH_GID = YES
|
||||||
|
|
||||||
|
|
||||||
|
[auditor]
|
||||||
|
BASE_URL = "http://localhost:8083/"
|
||||||
|
|
||||||
[taler]
|
[taler]
|
||||||
currency = KUDOS
|
currency = KUDOS
|
||||||
|
|
||||||
|
@ -47,8 +47,7 @@ static struct TALER_TESTING_BankConfiguration bc;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main function that will tell the interpreter what commands to
|
* Main function that will tell the interpreter what commands to run.
|
||||||
* run.
|
|
||||||
*
|
*
|
||||||
* @param cls closure
|
* @param cls closure
|
||||||
* @param is interpreter we use to run commands
|
* @param is interpreter we use to run commands
|
||||||
@ -58,9 +57,31 @@ run (void *cls,
|
|||||||
struct TALER_TESTING_Interpreter *is)
|
struct TALER_TESTING_Interpreter *is)
|
||||||
{
|
{
|
||||||
struct TALER_TESTING_Command commands[] = {
|
struct TALER_TESTING_Command commands[] = {
|
||||||
|
#if FIXME_MIGRATION_DONE
|
||||||
|
/* this currently fails, because the
|
||||||
|
auditor is already added by the test setup logic */
|
||||||
|
TALER_TESTING_cmd_auditor_del ("del-auditor-NOT-FOUND",
|
||||||
|
MHD_HTTP_NOT_FOUND,
|
||||||
|
false),
|
||||||
|
#endif
|
||||||
|
TALER_TESTING_cmd_auditor_add ("add-auditor-BAD-SIG",
|
||||||
|
MHD_HTTP_FORBIDDEN,
|
||||||
|
true),
|
||||||
TALER_TESTING_cmd_auditor_add ("add-auditor-OK",
|
TALER_TESTING_cmd_auditor_add ("add-auditor-OK",
|
||||||
MHD_HTTP_NO_CONTENT,
|
MHD_HTTP_NO_CONTENT,
|
||||||
false),
|
false),
|
||||||
|
TALER_TESTING_cmd_auditor_add ("add-auditor-OK-idempotent",
|
||||||
|
MHD_HTTP_NO_CONTENT,
|
||||||
|
false),
|
||||||
|
TALER_TESTING_cmd_auditor_del ("del-auditor-BAD-SIG",
|
||||||
|
MHD_HTTP_FORBIDDEN,
|
||||||
|
true),
|
||||||
|
TALER_TESTING_cmd_auditor_del ("del-auditor-OK",
|
||||||
|
MHD_HTTP_NO_CONTENT,
|
||||||
|
false),
|
||||||
|
TALER_TESTING_cmd_auditor_del ("del-auditor-IDEMPOTENT",
|
||||||
|
MHD_HTTP_NO_CONTENT,
|
||||||
|
false),
|
||||||
TALER_TESTING_cmd_end ()
|
TALER_TESTING_cmd_end ()
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -91,7 +112,7 @@ main (int argc,
|
|||||||
* fetches the port number from config in order to see
|
* fetches the port number from config in order to see
|
||||||
* if it's available. */
|
* if it's available. */
|
||||||
switch (TALER_TESTING_prepare_exchange (CONFIG_FILE,
|
switch (TALER_TESTING_prepare_exchange (CONFIG_FILE,
|
||||||
GNUNET_YES,
|
GNUNET_YES, /* reset DB? */
|
||||||
&ec))
|
&ec))
|
||||||
{
|
{
|
||||||
case GNUNET_SYSERR:
|
case GNUNET_SYSERR:
|
||||||
|
@ -717,6 +717,87 @@ TALER_TESTING_setup_with_exchange (TALER_TESTING_Main main_cb,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stop taler-exchange-crypto helpers.
|
||||||
|
*
|
||||||
|
* @param[in] helpers the process handles.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
stop_helpers (struct GNUNET_OS_Process *helpers[2])
|
||||||
|
{
|
||||||
|
for (unsigned int i = 0; i<2; i++)
|
||||||
|
{
|
||||||
|
if (NULL == helpers[i])
|
||||||
|
continue;
|
||||||
|
GNUNET_break (0 ==
|
||||||
|
GNUNET_OS_process_kill (helpers[i],
|
||||||
|
SIGTERM));
|
||||||
|
GNUNET_break (GNUNET_OK ==
|
||||||
|
GNUNET_OS_process_wait (helpers[i]));
|
||||||
|
GNUNET_OS_process_destroy (helpers[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start taler-exchange-crypto helpers.
|
||||||
|
*
|
||||||
|
* @param config_filename configuration file to use
|
||||||
|
* @param[out] helpers where to store the process handles.
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
start_helpers (const char *config_filename,
|
||||||
|
struct GNUNET_OS_Process *helpers[2])
|
||||||
|
{
|
||||||
|
char *dir;
|
||||||
|
|
||||||
|
dir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_LIBEXECDIR);
|
||||||
|
if (NULL == dir)
|
||||||
|
{
|
||||||
|
GNUNET_break (0);
|
||||||
|
return GNUNET_SYSERR;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
char *fn;
|
||||||
|
|
||||||
|
GNUNET_asprintf (&fn,
|
||||||
|
"%s/%s",
|
||||||
|
dir,
|
||||||
|
"taler-helper-crypto-eddsa");
|
||||||
|
helpers[0] = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_ALL,
|
||||||
|
NULL, NULL, NULL,
|
||||||
|
fn,
|
||||||
|
"taler-helper-crypto-eddsa",
|
||||||
|
"-c", config_filename,
|
||||||
|
NULL);
|
||||||
|
GNUNET_free (fn);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
char *fn;
|
||||||
|
|
||||||
|
GNUNET_asprintf (&fn,
|
||||||
|
"%s/%s",
|
||||||
|
dir,
|
||||||
|
"taler-helper-crypto-rsa");
|
||||||
|
helpers[1] = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_ALL,
|
||||||
|
NULL, NULL, NULL,
|
||||||
|
fn,
|
||||||
|
"taler-helper-crypto-rsa",
|
||||||
|
"-c", config_filename,
|
||||||
|
NULL);
|
||||||
|
GNUNET_free (fn);
|
||||||
|
}
|
||||||
|
GNUNET_free (dir);
|
||||||
|
if ( (NULL == helpers[0]) ||
|
||||||
|
(NULL == helpers[1]) )
|
||||||
|
{
|
||||||
|
stop_helpers (helpers);
|
||||||
|
return GNUNET_SYSERR;
|
||||||
|
}
|
||||||
|
return GNUNET_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize scheduler loop and curl context for the test case
|
* Initialize scheduler loop and curl context for the test case
|
||||||
* including starting and stopping the exchange using the given
|
* including starting and stopping the exchange using the given
|
||||||
@ -727,12 +808,13 @@ TALER_TESTING_setup_with_exchange (TALER_TESTING_Main main_cb,
|
|||||||
* @return #GNUNET_OK if no errors occurred.
|
* @return #GNUNET_OK if no errors occurred.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
TALER_TESTING_setup_with_exchange_cfg (void *cls,
|
TALER_TESTING_setup_with_exchange_cfg (
|
||||||
const struct
|
void *cls,
|
||||||
GNUNET_CONFIGURATION_Handle *cfg)
|
const struct GNUNET_CONFIGURATION_Handle *cfg)
|
||||||
{
|
{
|
||||||
const struct TALER_TESTING_SetupContext *setup_ctx = cls;
|
const struct TALER_TESTING_SetupContext *setup_ctx = cls;
|
||||||
struct GNUNET_OS_Process *exchanged;
|
struct GNUNET_OS_Process *exchanged;
|
||||||
|
struct GNUNET_OS_Process *helpers[2];
|
||||||
unsigned long long port;
|
unsigned long long port;
|
||||||
char *serve;
|
char *serve;
|
||||||
char *base_url;
|
char *base_url;
|
||||||
@ -777,6 +859,14 @@ TALER_TESTING_setup_with_exchange_cfg (void *cls,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
GNUNET_free (serve);
|
GNUNET_free (serve);
|
||||||
|
if (GNUNET_OK !=
|
||||||
|
start_helpers (setup_ctx->config_filename,
|
||||||
|
helpers))
|
||||||
|
{
|
||||||
|
GNUNET_break (0);
|
||||||
|
GNUNET_free (base_url);
|
||||||
|
return 77;
|
||||||
|
}
|
||||||
exchanged = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_ALL,
|
exchanged = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_ALL,
|
||||||
NULL, NULL, NULL,
|
NULL, NULL, NULL,
|
||||||
"taler-exchange-httpd",
|
"taler-exchange-httpd",
|
||||||
@ -784,7 +874,13 @@ TALER_TESTING_setup_with_exchange_cfg (void *cls,
|
|||||||
"-a", /* some tests may need timetravel */
|
"-a", /* some tests may need timetravel */
|
||||||
"-c", setup_ctx->config_filename,
|
"-c", setup_ctx->config_filename,
|
||||||
NULL);
|
NULL);
|
||||||
|
if (NULL == exchanged)
|
||||||
|
{
|
||||||
|
GNUNET_break (0);
|
||||||
|
GNUNET_free (base_url);
|
||||||
|
stop_helpers (helpers);
|
||||||
|
return 77;
|
||||||
|
}
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
GNUNET_CONFIGURATION_get_value_string (cfg,
|
GNUNET_CONFIGURATION_get_value_string (cfg,
|
||||||
"exchange",
|
"exchange",
|
||||||
@ -794,12 +890,14 @@ TALER_TESTING_setup_with_exchange_cfg (void *cls,
|
|||||||
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
|
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
|
||||||
"exchange",
|
"exchange",
|
||||||
"BASE_URL");
|
"BASE_URL");
|
||||||
|
stop_helpers (helpers);
|
||||||
return GNUNET_NO;
|
return GNUNET_NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 != TALER_TESTING_wait_exchange_ready (base_url))
|
if (0 != TALER_TESTING_wait_exchange_ready (base_url))
|
||||||
{
|
{
|
||||||
GNUNET_free (base_url);
|
GNUNET_free (base_url);
|
||||||
|
stop_helpers (helpers);
|
||||||
return 77;
|
return 77;
|
||||||
}
|
}
|
||||||
GNUNET_free (base_url);
|
GNUNET_free (base_url);
|
||||||
@ -816,6 +914,7 @@ TALER_TESTING_setup_with_exchange_cfg (void *cls,
|
|||||||
GNUNET_break (GNUNET_OK ==
|
GNUNET_break (GNUNET_OK ==
|
||||||
GNUNET_OS_process_wait (exchanged));
|
GNUNET_OS_process_wait (exchanged));
|
||||||
GNUNET_OS_process_destroy (exchanged);
|
GNUNET_OS_process_destroy (exchanged);
|
||||||
|
stop_helpers (helpers);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user