Update tar test to avoid touching before hardlinking

Touching the file before hardlinking was covering up a bug in
how hard links are handled in tar. Without the touch the hardlink
should still be included and both files should hardlink after
the tar is applied.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
This commit is contained in:
Derek McGowan 2017-03-30 16:47:05 +02:00
parent 8affca40bb
commit 2b186fd1f6
No known key found for this signature in database
GPG Key ID: F58C5D0A4405ACDB

View File

@ -6,7 +6,6 @@ import (
"os" "os"
"os/exec" "os/exec"
"testing" "testing"
"time"
_ "crypto/sha256" _ "crypto/sha256"
@ -67,8 +66,6 @@ func TestDiffApply(t *testing.T) {
fstest.RemoveAll("/home"), fstest.RemoveAll("/home"),
fstest.CreateDir("/home/derek", 0700), fstest.CreateDir("/home/derek", 0700),
fstest.CreateFile("/home/derek/.bashrc", []byte("#not going away\n"), 0640), fstest.CreateFile("/home/derek/.bashrc", []byte("#not going away\n"), 0640),
// "/etc/hosts" must be touched to be hardlinked in same layer
fstest.Chtime("/etc/hosts", time.Now()),
fstest.Link("/etc/hosts", "/etc/hosts.allow"), fstest.Link("/etc/hosts", "/etc/hosts.allow"),
), ),
} }