-
Notifications
You must be signed in to change notification settings - Fork 3
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
add test for api_client slow API call logging #127
add test for api_client slow API call logging #127
Conversation
415b757
to
7dc5d35
Compare
390 tests were run on |
test_utils/src/mock_server.rs
Outdated
#[derive(Debug, Clone)] | ||
pub struct MockServerBuilder { | ||
repo_create_handler: MethodRouter<SharedMockServerState>, | ||
create_bundle_handler: MethodRouter<SharedMockServerState>, | ||
get_quarantining_config_handler: MethodRouter<SharedMockServerState>, | ||
s3_upload_handler: MethodRouter<SharedMockServerState>, | ||
} | ||
|
||
impl MockServerBuilder { | ||
pub fn new() -> Self { | ||
Self { | ||
repo_create_handler: post(repo_create_handler), | ||
create_bundle_handler: post(create_bundle_handler), | ||
get_quarantining_config_handler: post(get_quarantining_config_handler), | ||
s3_upload_handler: put(s3_upload_handler), | ||
} | ||
} |
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.
allows setting the route handlers for doing things like failed API calls, slow API calls, etc.
let mut mock_server_builder = MockServerBuilder::new(); | ||
let logs = mock_logger(None); | ||
let (events, guard) = mock_sentry(); | ||
|
||
async fn slow_s3_upload_handler() -> Response<String> { | ||
time::sleep(Duration::from_secs(11)).await; | ||
Response::new(String::from("OK")) | ||
} | ||
mock_server_builder.set_s3_upload_handler(slow_s3_upload_handler); |
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.
Now we have some really awesome ability to capture logs, Sentry events, and modify APIs for tests
27166f5
to
c9483e5
Compare
b3b7442
to
52d9a2a
Compare
52d9a2a
to
ed683ea
Compare
depends on #118
Adds more testing for the
ApiClient
, plus the logging and reporting it performs