-
Notifications
You must be signed in to change notification settings - Fork 3
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
test(sync): restore failing tests #8
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ import ( | |
"os" | ||
"path/filepath" | ||
"strings" | ||
"syscall" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
|
@@ -34,6 +35,23 @@ func TestFsSyncer_Sync(t *testing.T) { | |
"it should copy a directory": { | ||
fixtureSrc: "src/dir", | ||
}, | ||
"it should copy a hard link": { | ||
fixtureSrc: "src/hardlink", | ||
additionalSpecs: func(t *testing.T, src, dst string) { | ||
apath := filepath.Join(dst, "a") | ||
bpath := filepath.Join(dst, "b") | ||
|
||
astat, err := os.Lstat(apath) | ||
assert.NoError(t, err) | ||
|
||
bstat, err := os.Lstat(bpath) | ||
assert.NoError(t, err) | ||
|
||
asysstat := astat.Sys().(*syscall.Stat_t) | ||
bsysstat := bstat.Sys().(*syscall.Stat_t) | ||
assert.Equal(t, asysstat.Ino, bsysstat.Ino) | ||
}, | ||
}, | ||
"it should copy a symlink": { | ||
fixtureSrc: "src/symlink", | ||
}, | ||
|
@@ -43,6 +61,16 @@ func TestFsSyncer_Sync(t *testing.T) { | |
"it should keep the symlink to a relative path": { | ||
fixtureSrc: "src/relative-symlink", | ||
}, | ||
"it should replace a file with the same content but not the same mtime": { | ||
fixtureSrc: "src/file", | ||
fixtureDst: "dst/cp-file", | ||
expectedChanges: []string{"a"}, | ||
}, | ||
"it should replace a file with the same size but not the same mtime": { | ||
fixtureSrc: "src/file", | ||
fixtureDst: "dst/same-size", | ||
expectedChanges: []string{"a"}, | ||
}, | ||
Comment on lines
+64
to
+73
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These tests are impossible using on the CI as a |
||
"it should not replace a file with the same content but not the same mtime if checksum checks are enabled": { | ||
fixtureSrc: "src/file", | ||
fixtureDst: "dst/cp-file", | ||
|
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.
In this test we want to test that the files
a
andb
are hard links. But this test seems impossible to do on the CI as hard links are not supported in Git: https://stackoverflow.com/a/3731139/1351436