e10c7b3f07
The "TestChangesWithChanges" case randomlly fails on my development VM with the following errors: ``` --- FAIL: TestChangesWithChanges (0.00s) changes_test.go:201: no change for expected change C /dir1/subfolder != A /dir1/subfolder/newFile ``` If I apply the following patch to changes_test.go, the test passes. ```diff diff --git a/pkg/archive/changes_test.go b/pkg/archive/changes_test.go index 290b2dd..ba1aca0 100644 --- a/pkg/archive/changes_test.go +++ b/pkg/archive/changes_test.go @@ -156,6 +156,7 @@ func TestChangesWithChanges(t *testing.T) { } defer os.RemoveAll(layer) createSampleDir(t, layer) + time.Sleep(5 * time.Millisecond) os.MkdirAll(path.Join(layer, "dir1/subfolder"), 0740) // Let's modify modtime for dir1 to be sure it's the same for the two layer (to not having false positive) ``` It seems that if a file is created immediately after the directory is created, the `archive.Changes` function could't recognize that the parent directory of the new file is modified. Perhaps the problem may reproduce on machines with low time precision? I had successfully reproduced the failure on my development VM as well as a VM on DigitalOcean. Signed-off-by: Shijiang Wei <mountkin@gmail.com> |
||
---|---|---|
.. | ||
testdata | ||
archive.go | ||
archive_test.go | ||
archive_unix.go | ||
archive_unix_test.go | ||
archive_windows.go | ||
archive_windows_test.go | ||
changes.go | ||
changes_posix_test.go | ||
changes_test.go | ||
changes_unix.go | ||
changes_windows.go | ||
diff.go | ||
diff_test.go | ||
example_changes.go | ||
README.md | ||
time_linux.go | ||
time_unsupported.go | ||
utils_test.go | ||
wrap.go | ||
wrap_test.go |
This code provides helper functions for dealing with archive files.