Skip to content

Test execution hangs if guards are used in multiple tests #322

Closed
@rasviitanen

Description

@rasviitanen

Environment

How do you use Sentry?
sentry.io

Which SDK and version?
sentry-rust (0.22.0)

Toolchain:
stable-x86_64-pc-windows-msvc (default)
rustc 1.50.0 (cb75ad5db 2021-02-10)

Steps to Reproduce

  1. Define two tests that creates guards:
#[test]
fn test_a() {
    let _guard = sentry::init(sentry::ClientOptions {
        ..Default::default()
    });
}

#[test]
fn test_b() {
    let _guard = sentry::init(sentry::ClientOptions {
        ..Default::default()
    });
}
  1. Run cargo test
  2. Get output:
running 2 tests
test tests::test_a ... ok
test tests::test_b ... ok

test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.03s 
  1. Test execution freezes and doesn't return
  2. Here is an example application to reproduce the problem: https://github.com/rasviitanen/sentry-bug

Running the tests individually works fine

Expected Result

The test execution should finish with exit 0.

Actual Result

running 2 tests
test observability::tests::test_a ... ok
test observability::tests::test_b ... ok

test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 63 filtered out; finished in 0.03s 
<here it just freezes and you have to press ctrl+c to exit>

We didn't experience any issues with this in 0.19.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions