Testing for the /deposit api call

This commit is contained in:
Fournier Nicolas 2015-08-03 10:26:52 +02:00
parent 8cd6fc9b98
commit f0a1941f39
3 changed files with 79 additions and 49 deletions

View File

@ -25,14 +25,14 @@
#define NB_DENOMINATION_INIT 15
#define NB_DENOMINATION_SAVE 15
#define NB_RESERVE_INIT 10000
#define NB_RESERVE_SAVE 1000
#define NB_RESERVE_INIT 100
#define NB_RESERVE_SAVE 10
#define NB_DEPOSIT_INIT 10000
#define NB_DEPOSIT_SAVE 1000
#define NB_DEPOSIT_INIT 100
#define NB_DEPOSIT_SAVE 10
#define NB_WITHDRAW_INIT 10000
#define NB_WITHDRAW_SAVE 1000
#define NB_WITHDRAW_INIT 100
#define NB_WITHDRAW_SAVE 10
/**
* Runs the performances tests for the mint database
@ -255,6 +255,25 @@ main (int argc, char ** argv)
"item/sec",
NB_WITHDRAW_SAVE),
PERF_TALER_MINTDB_INIT_CMD_DEBUG ("End of /withdraw/sign"),
PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("12 - start"),
PERF_TALER_MINTDB_INIT_CMD_LOOP ("12 - /deposit",
NB_DEPOSIT_SAVE),
PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("12 - coin",
"12 - /deposit",
"03 - save coin"),
PERF_TALER_MINTDB_INIT_CMD_DEPOSIT ("12 - deposit",
"12 - coin"),
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("",
"12 - /deposit"),
PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("12 - stop"),
PERF_TALER_MINTDB_INIT_CMD_GAUGER ("",
"12 - start",
"12 - stop",
"POSTGRES",
"Number of /deposit per second",
"item/sec",
NB_DEPOSIT_SAVE),
PERF_TALER_MINTDB_INIT_CMD_END (""),
};

View File

@ -191,16 +191,15 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s",
"%d:Undefined reference to %s\n",
i,
cmd[i].details.end_loop.label_loop);
return GNUNET_SYSERR;
}
if (PERF_TALER_MINTDB_CMD_LOOP != cmd[ret].command)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s",
"%d:Wrong type reference to %s\n",
i,
cmd[i].details.end_loop.label_loop);
return GNUNET_SYSERR;
@ -218,7 +217,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s",
"%d:Undefined reference to %s\n",
i,
cmd[i].details.save_array.label_save);
return GNUNET_SYSERR;
@ -226,7 +225,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (PERF_TALER_MINTDB_NONE == cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s",
"%d:Wrong type reference to %s\n",
i,
cmd[i].details.save_array.label_save);
return GNUNET_SYSERR;
@ -238,7 +237,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s",
"%d:Undefined reference to %s\n",
i,
cmd[i].details.save_array.label_loop);
return GNUNET_SYSERR;
@ -246,7 +245,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (PERF_TALER_MINTDB_CMD_LOOP != cmd[ret].command)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s",
"%d:Wrong type reference to %s\n",
i,
cmd[i].details.save_array.label_loop);
return GNUNET_SYSERR;
@ -271,7 +270,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s",
"%d:Undefined reference to %s\n",
i,
cmd[i].details.load_array.label_save);
return GNUNET_SYSERR;
@ -279,7 +278,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (PERF_TALER_MINTDB_CMD_SAVE_ARRAY != cmd[ret].command)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s",
"%d:Wrong type reference to %s\n",
i,
cmd[i].details.load_array.label_save);
return GNUNET_SYSERR;
@ -291,7 +290,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s",
"%d:Undefined reference to %s\n",
i,
cmd[i].details.load_array.label_loop);
return GNUNET_SYSERR;
@ -299,7 +298,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (PERF_TALER_MINTDB_CMD_LOOP != cmd[ret].command)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s",
"%d:Wrong type reference to %s\n",
i,
cmd[i].details.load_array.label_loop);
return GNUNET_SYSERR;
@ -325,16 +324,15 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s",
"%d:Undefined reference to %s\n",
i,
cmd[i].details.load_random.label_save);
return GNUNET_SYSERR;
}
if (PERF_TALER_MINTDB_CMD_SAVE_ARRAY != cmd[ret].command)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s",
"%d:Wrong type reference to %s\n",
i,
cmd[i].details.load_random.label_save);
return GNUNET_SYSERR;
@ -352,7 +350,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s",
"%d:Undefined reference to %s\n",
i,
cmd[i].details.gauger.label_start);
return GNUNET_SYSERR;
@ -360,7 +358,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (PERF_TALER_MINTDB_TIME != cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s",
"%d:Wrong type reference to %s\n",
i,
cmd[i].details.gauger.label_start);
return GNUNET_SYSERR;
@ -372,7 +370,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s",
"%d:Undefined reference to %s\n",
i,
cmd[i].details.gauger.label_stop);
return GNUNET_SYSERR;
@ -380,7 +378,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (PERF_TALER_MINTDB_TIME != cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s",
"%d:Wrong type reference to %s\n",
i,
cmd[i].details.gauger.label_stop);
return GNUNET_SYSERR;
@ -398,7 +396,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s",
"%d:Undefined reference to %s\n",
i,
cmd[i].details.insert_deposit.label_coin);
return GNUNET_SYSERR;
@ -406,7 +404,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (PERF_TALER_MINTDB_COIN != cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s",
"%d:Wrong type reference to %s\n",
i,
cmd[i].details.insert_deposit.label_coin);
return GNUNET_SYSERR;
@ -424,7 +422,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s",
"%d:Undefined reference to %s\n",
i,
cmd[i].details.get_deposit.label_deposit);
return GNUNET_SYSERR;
@ -432,7 +430,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (PERF_TALER_MINTDB_DEPOSIT != cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s",
"%d:Wrong type reference to %s\n",
i,
cmd[i].details.get_deposit.label_deposit);
return GNUNET_SYSERR;
@ -450,7 +448,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s",
"%d:Undefined reference to %s\n",
i,
cmd[i].details.get_reserve.label_reserve);
return GNUNET_SYSERR;
@ -458,7 +456,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (PERF_TALER_MINTDB_RESERVE != cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s",
"%d:Wrong type reference to %s\n",
i,
cmd[i].details.get_reserve.label_reserve);
return GNUNET_SYSERR;
@ -476,7 +474,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s",
"%d:Undefined reference to %s\n",
i,
cmd[i].details.get_reserve_history.label_reserve);
return GNUNET_SYSERR;
@ -484,7 +482,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (PERF_TALER_MINTDB_RESERVE != cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s",
"%d:Wrong type reference to %s\n",
i,
cmd[i].details.get_reserve_history.label_reserve);
return GNUNET_SYSERR;
@ -502,7 +500,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s",
"%d:Undefined reference to %s\n",
i,
cmd[i].details.get_denomination.label_denom);
return GNUNET_SYSERR;
@ -510,7 +508,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (PERF_TALER_MINTDB_DENOMINATION_INFO != cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s",
"%d:Wrong type reference to %s\n",
i,
cmd[i].details.get_denomination.label_denom);
return GNUNET_SYSERR;
@ -528,7 +526,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s",
"%d:Undefined reference to %s\n",
i,
cmd[i].details.insert_withdraw.label_dki);
return GNUNET_SYSERR;
@ -536,7 +534,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (PERF_TALER_MINTDB_DENOMINATION_INFO != cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s",
"%d:Wrong type reference to %s\n",
i,
cmd[i].details.insert_withdraw.label_dki);
return GNUNET_SYSERR;
@ -548,7 +546,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s",
"%d:Undefined reference to %s\n",
i,
cmd[i].details.insert_withdraw.label_reserve);
return GNUNET_SYSERR;
@ -556,7 +554,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (PERF_TALER_MINTDB_RESERVE != cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s",
"%d:Wrong type reference to %s\n",
i,
cmd[i].details.insert_withdraw.label_reserve);
return GNUNET_SYSERR;
@ -574,7 +572,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s",
"%d:Undefined reference to %s\n",
i,
cmd[i].details.get_withdraw.label_coin);
return GNUNET_SYSERR;
@ -582,7 +580,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
if (PERF_TALER_MINTDB_COIN != cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s",
"%d:Wrong type reference to %s\n",
i,
cmd[i].details.get_withdraw.label_coin);
return GNUNET_SYSERR;
@ -1236,14 +1234,20 @@ int
PERF_TALER_MINTDB_interpret (struct TALER_MINTDB_Plugin *db_plugin,
struct PERF_TALER_MINTDB_Cmd cmd[])
{
int ret;
struct PERF_TALER_MINTDB_interpreter_state state =
{.i = 0, .cmd = cmd, .plugin = db_plugin};
cmd_init (state.cmd);
GNUNET_assert (NULL !=
(state.session = db_plugin->get_session (db_plugin->cls,
GNUNET_YES)));
interpret (&state);
ret = cmd_init (state.cmd);
if (GNUNET_SYSERR == ret)
return ret;
state.session = db_plugin->get_session (db_plugin->cls,
GNUNET_YES);
GNUNET_assert (NULL != state.session);
ret = interpret (&state);
if (GNUNET_SYSERR == ret)
return ret;
cmd_clean (cmd);
return GNUNET_OK;
}
@ -1412,6 +1416,5 @@ PERF_TALER_MINTDB_run_benchmark (const char *benchmark_name,
}
TALER_MINTDB_plugin_unload (plugin);
GNUNET_CONFIGURATION_destroy (config);
return ret;
}

View File

@ -336,6 +336,14 @@
}
/**
* the /deposit API call
*/
#define PERF_TALER_MONTDB_INIT_CMD_DEPOSIT(_label, _label_coin)\
PERF_TALER_MINTDB_INIT_CMD_INSERT_DEPOSIT (_label ":insert deposit", _label_coin), \
PERF_TALER_MINTDB_INIT_CMD_GET_DEPOSIT (_label ":get deposit", _label ":insert deposit")
/**
* Inserts informations about a withdrawal in the database
*
@ -395,11 +403,11 @@
* @param _label the label of the command
* @param _label_coin the coin used for the deposit
*/
#define PERF_TALER_MINTDB_INIT_CMD_deposit(_label, _label_coin) \
#define PERF_TALER_MINTDB_INIT_CMD_DEPOSIT(_label, _label_coin) \
PERF_TALER_MINTDB_INIT_CMD_GET_COIN_TRANSACTION (_label "coin history", \
_label_coin), \
PERF_TALER_MINTDB_INIT_CMD_INSERT_DEPOSIT (_label "deposit", \
_label_coin),
_label_coin)
/**
@ -854,7 +862,7 @@ union PERF_TALER_MINTDB_CMD_Details
/**
* Extra data related to the #PERF_TALER_MINTDB_CMD_GET_WITHDRAW command
* Extra data related to the #PERF_TALER_MINTDB_CMD_INSERT_WITHDRAW command
*/
struct PERF_TALER_MINTDB_CMD_insertWithdrawDetails
{