-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(starknet_http_server): add metrics tests, still partial #2885
base: main
Are you sure you want to change the base?
Conversation
let added_transactions_total_count = | ||
parse_numeric_metric::<usize>(&metrics, ADDED_TRANSACTIONS_SUCCESS.0); | ||
let added_transactions_success_count = | ||
parse_numeric_metric::<usize>(&metrics, ADDED_TRANSACTIONS_TOTAL.0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The metric parsing variables appear to be swapped. added_transactions_total_count
is parsing ADDED_TRANSACTIONS_SUCCESS
when it should parse ADDED_TRANSACTIONS_TOTAL
, and added_transactions_success_count
is parsing ADDED_TRANSACTIONS_TOTAL
when it should parse ADDED_TRANSACTIONS_SUCCESS
. This mismatch would cause the test to validate incorrect metric values. To fix this, swap the metric constants in the parse_numeric_metric
calls.
Spotted by Graphite Reviewer
Is this helpful? React 👍 or 👎 to let us know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
i += 1; | ||
match i { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The counter i
is incremented before the match
statement, which causes the first case (i=0
) to be skipped. To properly test all cases, either move the increment after the match
or initialize i
to -1. This ensures the error case is actually tested.
Spotted by Graphite Reviewer
Is this helpful? React 👍 or 👎 to let us know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
95cfac8
to
a413721
Compare
478eed2
to
fd45754
Compare
a413721
to
e1fe383
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dismissed @graphite-app[bot] from a discussion.
Reviewable status: 0 of 4 files reviewed, 1 unresolved discussion (waiting on @graphite-app[bot])
i += 1; | ||
match i { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
e1fe383
to
f7fd623
Compare
fd45754
to
e2cda4a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: 1 of 4 files reviewed, 2 unresolved discussions (waiting on @graphite-app[bot] and @Itay-Tsabary-Starkware)
crates/starknet_http_server/src/http_server_test.rs
line 50 at r3 (raw file):
// The current setup does not test that. Fix the bug and update this test accordingly. // Create a mock gateway client that returns arbitrary responses. let txs_to_send = 3;
Should this be a constant?
Code quote:
txs_to_send
f7fd623
to
736c0be
Compare
e2cda4a
to
7d2cfda
Compare
736c0be
to
636b170
Compare
7d2cfda
to
461cf28
Compare
636b170
to
6f08153
Compare
6f08153
to
5e615a8
Compare
c2c4748
to
745ef6b
Compare
commit-id:ce82f0b7
745ef6b
to
644ea31
Compare
Benchmark movements: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 4 files reviewed, 2 unresolved discussions (waiting on @graphite-app[bot] and @nadin-Starkware)
crates/starknet_http_server/src/http_server_test.rs
line 50 at r3 (raw file):
Previously, nadin-Starkware (Nadin Jbara) wrote…
Should this be a constant?
Done.
let added_transactions_total_count = | ||
parse_numeric_metric::<usize>(&metrics, ADDED_TRANSACTIONS_SUCCESS.0); | ||
let added_transactions_success_count = | ||
parse_numeric_metric::<usize>(&metrics, ADDED_TRANSACTIONS_TOTAL.0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Stack: