diff options
Diffstat (limited to 'src/test/test_hs_metrics.c')
-rw-r--r-- | src/test/test_hs_metrics.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/test/test_hs_metrics.c b/src/test/test_hs_metrics.c index 03f6aedbb4..b7c0ab53da 100644 --- a/src/test/test_hs_metrics.c +++ b/src/test/test_hs_metrics.c @@ -40,7 +40,7 @@ test_metrics(void *arg) /* Update entry by identifier. */ hs_metrics_update_by_ident(HS_METRICS_NUM_INTRODUCTIONS, - &service->keys.identity_pk, 0, 42); + &service->keys.identity_pk, 0, NULL, 42); /* Confirm the entry value. */ const smartlist_t *entries = metrics_store_get_all(service->metrics.store, @@ -53,24 +53,29 @@ test_metrics(void *arg) /* Update entry by service now. */ hs_metrics_update_by_service(HS_METRICS_NUM_INTRODUCTIONS, - service, 0, 42); + service, 0, NULL, 42); tt_int_op(metrics_store_entry_get_value(entry), OP_EQ, 84); + const char *reason = HS_METRICS_ERR_INTRO_REQ_BAD_AUTH_KEY; + /* Update tor_hs_intro_rejected_intro_req_count */ hs_metrics_update_by_ident(HS_METRICS_NUM_REJECTED_INTRO_REQ, - &service->keys.identity_pk, 0, 112); + &service->keys.identity_pk, 0, reason, 112); entries = metrics_store_get_all(service->metrics.store, "tor_hs_intro_rejected_intro_req_count"); tt_assert(entries); - tt_int_op(smartlist_len(entries), OP_EQ, 1); - entry = smartlist_get(entries, 0); + tt_int_op(smartlist_len(entries), OP_EQ, + hs_metrics_intro_req_error_reasons_size); + + entry = metrics_store_find_entry_with_label( + entries, "reason=\"bad_auth_key\""); tt_assert(entry); tt_int_op(metrics_store_entry_get_value(entry), OP_EQ, 112); /* Update tor_hs_intro_rejected_intro_req_count entry by service now. */ - hs_metrics_update_by_service(HS_METRICS_NUM_REJECTED_INTRO_REQ, - service, 0, 10); + hs_metrics_update_by_service(HS_METRICS_NUM_REJECTED_INTRO_REQ, service, 0, + reason, 10); tt_int_op(metrics_store_entry_get_value(entry), OP_EQ, 122); done: |