summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcello Stanisci <marcello.stanisci@inria.fr>2017-03-20 16:26:15 +0100
committerMarcello Stanisci <marcello.stanisci@inria.fr>2017-03-20 16:26:15 +0100
commitb6f8454085041d96777ad9bf4cbb61b8a040b42d (patch)
treedb330b81f0a580f26a4b82e7cb8eaef230876deb
parentb8f25a07e94cc9f421a547e8d6c9c8026d39f710 (diff)
downloadmerchant-b6f8454085041d96777ad9bf4cbb61b8a040b42d.tar.gz
merchant-b6f8454085041d96777ad9bf4cbb61b8a040b42d.tar.bz2
merchant-b6f8454085041d96777ad9bf4cbb61b8a040b42d.zip
'start' and 'nrows' not hardcoded anymore in testcase.
-rw-r--r--src/backenddb/plugin_merchantdb_postgres.c6
-rw-r--r--src/lib/test_merchant_api.c23
2 files changed, 25 insertions, 4 deletions
diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c
index 9de62944..ff1aafc7 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -826,6 +826,12 @@ postgres_store_transfer_to_proof (void *cls,
* @param merchant_pub instance's public key; only rows related to this
* instance are returned.
* @param start only rows with serial id less than start are returned.
+ * In other words, you lower `start` to get older records. The tipical
+ * usage is to firstly call `find_proposal_data_by_date`, so that you get
+ * the `nrows` youngest records. The oldest of those records will tell you
+ * from which timestamp and `start` you can query the DB in order to get
+ * furtherly older records, and so on. Alternatively, you can use always
+ * the same timestamp and just go behind in history by tuning `start`.
* @param nrows only nrows rows are returned.
* @param cb function to call with transaction data, can be NULL.
* @param cb_cls closure for @a cb
diff --git a/src/lib/test_merchant_api.c b/src/lib/test_merchant_api.c
index 58075c09..5e683320 100644
--- a/src/lib/test_merchant_api.c
+++ b/src/lib/test_merchant_api.c
@@ -596,6 +596,17 @@ struct Command
*/
struct TALER_MERCHANT_HistoryOperation *ho;
+ /**
+ * The backend will return records with row_id
+ * less than this value.
+ */
+ unsigned int start;
+
+ /**
+ * The backend will return at most `nrows` records.
+ */
+ unsigned int nrows;
+
} history;
@@ -1850,8 +1861,8 @@ interpreter_run (void *cls)
(cmd->details.history.ho = TALER_MERCHANT_history (ctx,
MERCHANT_URI,
instance,
- 20,
- 20,
+ cmd->details.history.start,
+ cmd->details.history.nrows,
cmd->details.history.date,
history_cb,
is)))
@@ -2342,14 +2353,18 @@ run (void *cls)
.expected_response_code = MHD_HTTP_OK,
/*all records to be returned*/
.details.history.date.abs_value_us = 43 * 1000LL * 1000LL,
- .details.history.nresult = 2
+ .details.history.nresult = 2,
+ .details.history.start = 10,
+ .details.history.nrows = 10
},
{ .oc = OC_HISTORY,
.label = "history-2",
.expected_response_code = MHD_HTTP_OK,
/*no records returned, time limit too ancient*/
.details.history.date.abs_value_us = 0,
- .details.history.nresult = 0
+ .details.history.nresult = 0,
+ .details.history.start = 10,
+ .details.history.nrows = 10
},
/* end of testcase */