-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
130 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,3 +42,4 @@ jobs: | |
uses: actions-rs/cargo@v1 | ||
with: | ||
command: test | ||
args: --all-features |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,9 +2,16 @@ fn main() { | |
let client = sentry::init("http://[email protected]:8123/12345"); | ||
|
||
// Everything before here runs in both app and crash reporter processes | ||
let _guard = sentry_rust_minidump::init(&client); | ||
let crash_handler = | ||
sentry_rust_minidump::init(&client).expect("could not initialize crash reporter"); | ||
// Everything after here runs in only the app process | ||
|
||
crash_handler.set_user(Some(sentry::User { | ||
username: Some("john_doe".into()), | ||
email: Some("[email protected]".into()), | ||
..Default::default() | ||
})); | ||
|
||
std::thread::sleep(std::time::Duration::from_secs(10)); | ||
|
||
unsafe { sadness_generator::raise_segfault() }; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,25 +6,40 @@ async fn test_example_app() -> Result<(), Box<dyn Error>> { | |
let envelope_rx = sentry_test_server::server(("127.0.0.1", 8123))?; | ||
|
||
// We need to await at some point otherwise the server doesn't seem to start | ||
actix_rt::time::sleep(Duration::from_secs(1)).await; | ||
actix_rt::time::sleep(Duration::from_secs(2)).await; | ||
|
||
Command::new("cargo") | ||
.args(["run", "--example", "app"]) | ||
.args(["run", "--example", "app", "--all-features"]) | ||
.spawn()? | ||
.wait()?; | ||
|
||
let env = envelope_rx.recv_timeout(Duration::from_secs(2))?; | ||
let env = envelope_rx.recv_timeout(Duration::from_secs(15))?; | ||
|
||
if let Ok(json) = sentry_test_server::to_json_pretty(&env) { | ||
println!("{}", json); | ||
} | ||
|
||
let item = env | ||
let env_item = env | ||
.items() | ||
.find(|item| matches!(item, EnvelopeItem::Event(_))) | ||
.expect("envelope should have an event"); | ||
|
||
let event = match env_item { | ||
EnvelopeItem::Event(event) => event.clone(), | ||
_ => unreachable!("envelope should have an event"), | ||
}; | ||
|
||
let user = event.user.expect("event should have a user"); | ||
|
||
assert_eq!(user.email, Some("[email protected]".into())); | ||
assert_eq!(user.username, Some("john_doe".into())); | ||
|
||
let env_item = env | ||
.items() | ||
.find(|item| matches!(item, EnvelopeItem::Attachment(_))) | ||
.expect("envelope should have an attachment"); | ||
|
||
let attachment = match item { | ||
let attachment = match env_item { | ||
EnvelopeItem::Attachment(attachment) => attachment, | ||
_ => unreachable!("envelope should have an attachment"), | ||
}; | ||
|