-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
test: Fix some flaky tests #7597
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
51 changes: 28 additions & 23 deletions
51
packages/browser-integration-tests/suites/public-api/startTransaction/basic_usage/subject.js
This file contains hidden or 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 |
---|---|---|
@@ -1,30 +1,35 @@ | ||
const transaction = Sentry.startTransaction({ name: 'test_transaction_1' }); | ||
const span_1 = transaction.startChild({ | ||
op: 'span_1', | ||
data: { | ||
foo: 'bar', | ||
baz: [1, 2, 3], | ||
}, | ||
}); | ||
for (let i = 0; i < 2000; i++); | ||
async function run() { | ||
const transaction = Sentry.startTransaction({ name: 'test_transaction_1' }); | ||
const span_1 = transaction.startChild({ | ||
op: 'span_1', | ||
data: { | ||
foo: 'bar', | ||
baz: [1, 2, 3], | ||
}, | ||
}); | ||
|
||
// span_1 finishes | ||
span_1.finish(); | ||
await new Promise(resolve => setTimeout(resolve, 1)); | ||
|
||
// span_2 doesn't finish | ||
const span_2 = transaction.startChild({ op: 'span_2' }); | ||
for (let i = 0; i < 4000; i++); | ||
// span_1 finishes | ||
span_1.finish(); | ||
|
||
const span_3 = transaction.startChild({ op: 'span_3' }); | ||
for (let i = 0; i < 4000; i++); | ||
// span_2 doesn't finish | ||
const span_2 = transaction.startChild({ op: 'span_2' }); | ||
await new Promise(resolve => setTimeout(resolve, 1)); | ||
|
||
// span_4 is the child of span_3 but doesn't finish. | ||
const span_4 = span_3.startChild({ op: 'span_4', data: { qux: 'quux' } }); | ||
const span_3 = transaction.startChild({ op: 'span_3' }); | ||
await new Promise(resolve => setTimeout(resolve, 1)); | ||
|
||
// span_5 is another child of span_3 but finishes. | ||
const span_5 = span_3.startChild({ op: 'span_5' }).finish(); | ||
// span_4 is the child of span_3 but doesn't finish. | ||
const span_4 = span_3.startChild({ op: 'span_4', data: { qux: 'quux' } }); | ||
|
||
// span_3 also finishes | ||
span_3.finish(); | ||
// span_5 is another child of span_3 but finishes. | ||
const span_5 = span_3.startChild({ op: 'span_5' }).finish(); | ||
|
||
transaction.finish(); | ||
// span_3 also finishes | ||
span_3.finish(); | ||
|
||
transaction.finish(); | ||
} | ||
|
||
run(); | ||
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.