-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Use unique temp dirs in unit tests #3494
Conversation
ba64451
to
1d6a27f
Compare
Codecov Report
@@ Coverage Diff @@
## master #3494 +/- ##
==========================================
- Coverage 35.74% 35.72% -0.02%
==========================================
Files 284 284
Lines 40778 40792 +14
==========================================
- Hits 14576 14574 -2
- Misses 24041 24054 +13
- Partials 2161 2164 +3
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good to me. But I haven't tested it yet.
Does integration tests also reuse these directories? |
@lafriks No |
But we don't run tests in parallel I think |
@lafriks I know, but
|
@ethantkoenig problem with this is that these directories will be left undeleted I think |
@lafriks Good point, fixed |
@ethantkoenig as for 2nd point - To me it looks like something keeps running in background that uses repos and that's why there is problem that they can't be deleted for next test... I spend 5 hours on weekend trying to pinpoint where but with no success :( |
models/unit_tests.go
Outdated
os.Exit(m.Run()) | ||
exitStatus := m.Run() | ||
if err = os.RemoveAll(setting.RepoRootPath); err != nil { | ||
fatalTestError("os.RemoveAll: %v\n", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not just use assert.NoError(t, err)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no t
variable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, sorry, overlooked :)
models/unit_tests.go
Outdated
} | ||
|
||
os.Exit(m.Run()) | ||
exitStatus := m.Run() | ||
if err = os.RemoveAll(setting.RepoRootPath); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use removeAllWithRetry func
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
6001566
to
1f1b6eb
Compare
} | ||
|
||
os.Exit(m.Run()) | ||
exitStatus := m.Run() | ||
if err = removeAllWithRetry(setting.RepoRootPath); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should be defer
ed. Not done at the end
Using a fixed directory causes problems if you run tests in parallel.
Using a fixed directory may have also caused tests to be flaky (e.g. https://drone.gitea.io/go-gitea/gitea/3530/8).