Add option to initialized db, fixes 4858
Additionally remove the TESTRUN option, since the name is confusing and doesn't match the original semantics (temp tables). Test cases should now invoke the exchange httpd with the "-i" option.
This commit is contained in:
parent
c631ae1b60
commit
0bfb5b2509
@ -22,6 +22,9 @@ Use the configuration and other resources for the exchange to operate from DIRNA
|
|||||||
.IP "\-h, \-\-help"
|
.IP "\-h, \-\-help"
|
||||||
Print short help on options.
|
Print short help on options.
|
||||||
.B
|
.B
|
||||||
|
.IP "\-i, \-\-init-db"
|
||||||
|
Initialize the database by creating tables and indices if necessary.
|
||||||
|
.B
|
||||||
.IP "\-v, \-\-version"
|
.IP "\-v, \-\-version"
|
||||||
Print version information.
|
Print version information.
|
||||||
.B
|
.B
|
||||||
|
@ -31,4 +31,4 @@
|
|||||||
#
|
#
|
||||||
# Must be run from this directory.
|
# Must be run from this directory.
|
||||||
#
|
#
|
||||||
$AFL_HOME/afl-fuzz -i baseline/ -m 250 -o afl-tests/ -f /tmp/afl-input taler-exchange-httpd -f /tmp/afl-input -d test-exchange-home/ -C
|
$AFL_HOME/afl-fuzz -i baseline/ -m 250 -o afl-tests/ -f /tmp/afl-input taler-exchange-httpd -i -f /tmp/afl-input -d test-exchange-home/ -C
|
||||||
|
@ -3139,6 +3139,7 @@ main (int argc,
|
|||||||
"taler-exchange-httpd",
|
"taler-exchange-httpd",
|
||||||
"taler-exchange-httpd",
|
"taler-exchange-httpd",
|
||||||
"-c", "test_exchange_api.conf",
|
"-c", "test_exchange_api.conf",
|
||||||
|
"-i",
|
||||||
NULL);
|
NULL);
|
||||||
/* give child time to start and bind against the socket */
|
/* give child time to start and bind against the socket */
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
|
@ -24,9 +24,6 @@ MASTER_PUBLIC_KEY = 98NJW3CQHZQGQXTY3K85K531XKPAPAVV4Q5V8PYYRR00NJGZWNVG
|
|||||||
# How to access our database
|
# How to access our database
|
||||||
DB = postgres
|
DB = postgres
|
||||||
|
|
||||||
# Is this is a testcase, use transient DB actions?
|
|
||||||
TESTRUN = YES
|
|
||||||
|
|
||||||
[exchangedb-postgres]
|
[exchangedb-postgres]
|
||||||
DB_CONN_STR = "postgres:///talercheck"
|
DB_CONN_STR = "postgres:///talercheck"
|
||||||
|
|
||||||
|
@ -17,9 +17,6 @@ KEYDIR = ${TALER_DATA_HOME}/exchange/live-keys/
|
|||||||
# How to access our database
|
# How to access our database
|
||||||
DB = postgres
|
DB = postgres
|
||||||
|
|
||||||
# Is this is a testcase, use transient DB actions?
|
|
||||||
# TESTRUN = YES
|
|
||||||
|
|
||||||
# Where do we store the offline master private key of the exchange?
|
# Where do we store the offline master private key of the exchange?
|
||||||
MASTER_PRIV_FILE = ${TALER_DATA_HOME}/exchange/offline-keys/master.priv
|
MASTER_PRIV_FILE = ${TALER_DATA_HOME}/exchange/offline-keys/master.priv
|
||||||
|
|
||||||
|
@ -100,6 +100,11 @@ static struct MHD_Daemon *mhd_admin;
|
|||||||
*/
|
*/
|
||||||
static int no_admin;
|
static int no_admin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the database by creating tables and indices.
|
||||||
|
*/
|
||||||
|
static int init_db;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Port to run the daemon on.
|
* Port to run the daemon on.
|
||||||
*/
|
*/
|
||||||
@ -656,13 +661,10 @@ exchange_serve_process_config ()
|
|||||||
TEH_VALIDATION_done ();
|
TEH_VALIDATION_done ();
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
if (GNUNET_YES ==
|
if (0 != init_db)
|
||||||
GNUNET_CONFIGURATION_get_value_yesno (cfg,
|
|
||||||
"exchange",
|
|
||||||
"TESTRUN"))
|
|
||||||
{
|
{
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||||
"Running in TEST mode! Database contents will not persist!\n");
|
"Ensuring that tables and indices are created!\n");
|
||||||
TEH_plugin->create_tables (TEH_plugin->cls);
|
TEH_plugin->create_tables (TEH_plugin->cls);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -938,6 +940,9 @@ main (int argc,
|
|||||||
{'D', "disable-admin", NULL,
|
{'D', "disable-admin", NULL,
|
||||||
"do not run the /admin-HTTP server", 0,
|
"do not run the /admin-HTTP server", 0,
|
||||||
&GNUNET_GETOPT_set_one, &no_admin},
|
&GNUNET_GETOPT_set_one, &no_admin},
|
||||||
|
{'i', "init-db", NULL,
|
||||||
|
"create database tables and indicies if necessary", 0,
|
||||||
|
&GNUNET_GETOPT_set_one, &init_db},
|
||||||
{'t', "timeout", "SECONDS",
|
{'t', "timeout", "SECONDS",
|
||||||
"after how long do connections timeout by default (in seconds)", 1,
|
"after how long do connections timeout by default (in seconds)", 1,
|
||||||
&GNUNET_GETOPT_set_uint, &connection_timeout},
|
&GNUNET_GETOPT_set_uint, &connection_timeout},
|
||||||
|
@ -23,11 +23,6 @@ MASTER_PUBLIC_KEY = 98NJW3CQHZQGQXTY3K85K531XKPAPAVV4Q5V8PYYRR00NJGZWNVG
|
|||||||
# How to access our database
|
# How to access our database
|
||||||
DB = postgres
|
DB = postgres
|
||||||
|
|
||||||
# Is this is a testcase, use transient DB actions?
|
|
||||||
TESTRUN = YES
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[exchangedb-postgres]
|
[exchangedb-postgres]
|
||||||
DB_CONN_STR = "postgres:///talercheck"
|
DB_CONN_STR = "postgres:///talercheck"
|
||||||
|
@ -27,7 +27,7 @@ unset XDG_CONFIG_HOME
|
|||||||
# Setup keys.
|
# Setup keys.
|
||||||
taler-exchange-keyup -c test_taler_exchange_httpd.conf
|
taler-exchange-keyup -c test_taler_exchange_httpd.conf
|
||||||
# Run Exchange HTTPD (in background)
|
# Run Exchange HTTPD (in background)
|
||||||
taler-exchange-httpd -c test_taler_exchange_httpd.conf &
|
taler-exchange-httpd -c test_taler_exchange_httpd.conf -i &
|
||||||
# Give HTTP time to start
|
# Give HTTP time to start
|
||||||
sleep 5
|
sleep 5
|
||||||
# Finally run test...
|
# Finally run test...
|
||||||
|
Loading…
Reference in New Issue
Block a user