Closed bacongobbler closed 8 years ago
@kmala, @arschles and @aledbf are potential reviewers of this pull request based on my analysis of git blame
information. Thanks @bacongobbler!
Good job adding unit tests. 💚
If I'm bugging everyone else to add tests, it's only fair! :P
My only concern with this code is that we are writing to a location that usually is not writable by regular users (/var/run/secrets/...) so the only way to test this is to run the unit tests as root (which occurs within the test container), or by chown
'ing everything under /var/run/secrets as $USER. That really sucks for users running tests on their own machine, but given the way the code is written I don't see a way around that without refactoring.
the only way to test this is to run the unit tests as root
Well given that's the current CI environment, I think it's ok. I wonder if this could call t.Skip()
if it weren't root? Or maybe just add an early comment like // NOTE: these tests must run as root or a user with write access to /var/run/secrets
.
Using t.Skip() would be best for now. :)
@@ master #382 diff @@
==========================================
Files 24 25 +1
Lines 1105 1140 +35
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 463 476 +13
- Misses 619 636 +17
- Partials 23 28 +5
Powered by Codecov. Last updated by a0905cc...2a6f434
k, tests should skip if not being run as root. :)
The following code assumes that the file is a file, not a directory.
fixes #379