Skip to content
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

Fix data race #73

Merged
merged 2 commits into from
Jul 24, 2023
Merged

Fix data race #73

merged 2 commits into from
Jul 24, 2023

Conversation

nejtr0n
Copy link
Contributor

@nejtr0n nejtr0n commented Jul 24, 2023

Test results should be protected by mutex to prevent datarace in parallel tests

nejtr0n and others added 2 commits July 24, 2023 12:09
Test results should be protected by mutex to prevent datarace in parallel tests
@@ -21,7 +22,9 @@ func NewSuiteResult(container *allure.Container) SuiteResult {

// NewResult appends test result to suite result
func (sr *suiteResult) NewResult(result TestResult) {
sr.mu.Lock()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's best practice to use defer in case like this

sr.mu.Lock()
defer sr.mu.Unlock()

@koodeex koodeex linked an issue Jul 24, 2023 that may be closed by this pull request
@koodeex koodeex merged commit 97fb94f into ozontech:master Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Data race in parallel tests
2 participants