Skip to content

Write unit test to verify Hub cloning per thread #885

@bruno-garcia

Description

@bruno-garcia

A unit test on sentry-core to test the scope isolation on non-global hub mode:

pseudo code;

Sentry.init
Sentry.configureScope(s -> s.setTag("a", "a");
var e = new Semaphore(count: 2);
var s = new Semaphore(count: 2);
new Thread(() -> {
Sentry.configureScope(s -> s.setTag("b", "b");
e.set();
s.wait();
Sentry.configureScope(s -> assert(s.getTags(), 2); // make sure 'a' and 'b' are here
}
new Thread(() -> {
Sentry.configureScope(s -> s.setTag("c", "c");
e.set();
s.wait();
Sentry.configureScope(s -> assert(s.getTags(), 3); // make sure 'a', 'b' and 'c' are here
}
e.wait();
s.set();
Sentry.configureScope(s -> assert(s.getTags(), 1); // make sure 'a' only is here

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions