Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
osutil: honor SNAPD_UNSAFE_IO for testing #3725
Conversation
codecov-io
commented
Aug 14, 2017
•
Codecov Report
@@ Coverage Diff @@
## master #3725 +/- ##
==========================================
+ Coverage 75.84% 75.98% +0.13%
==========================================
Files 399 399
Lines 34525 34617 +92
==========================================
+ Hits 26184 26302 +118
+ Misses 6478 6460 -18
+ Partials 1863 1855 -8
Continue to review full report at Codecov.
|
niemeyer
approved these changes
Aug 14, 2017
LGTM, but let's please make the variable more clear:
| +// Allow disabling sync for testing. This brings massive improvements on | ||
| +// certain filesystems (like btrfs) and very much noticeable improvements in | ||
| +// all unit tests in genreal. | ||
| +var shouldReallySync bool = true |
niemeyer
Aug 14, 2017
Contributor
Let's please rename this to snapdUnsafeIO so the relationship to the variable is clear (we need to invert the tests too). We can also drop the = true/false part as it defaults to false.
In fact, we can probably inline:
var snapdUsafeIO = len(os.Args) > 0 && strings.HasSuffix(os.Args[0], ".test") && GetenvBool("SNAPD_UNSAFE_IO")
mvo5
approved these changes
Aug 16, 2017
Looks great! One suggestion/nitpick but feel free to ignore and merge anyway.
| +// Allow disabling sync for testing. This brings massive improvements on | ||
| +// certain filesystems (like btrfs) and very much noticeable improvements in | ||
| +// all unit tests in genreal. | ||
| +var snapdUnsafeIO bool = len(os.Args) > 0 && strings.HasSuffix(os.Args[0], ".test") && GetenvBool("SNAPD_UNSAFE_IO") |
zyga commentedAug 14, 2017
•
Edited 1 time
-
zyga
Aug 14, 2017
When SNAPD_UNSAFE_IO is set and we are testing (the executable ends with
.test) then skip some sync calls that are very very heavy. Doing this
can easily cut the timy by an order of magnitude.
As a non-scientific but useful measurement, overlord tests go down from
2 minutes 41 seconds to just 15 seconds. This is not representative to
all modules but when it matters, it is noticeable.
Signed-off-by: Zygmunt Krynicki me@zygoon.pl