Add tests for absolute paths.
@@ -330,6 +330,38 @@ func TestNewSyncItem(t *testing.T) {
Delete: map[string]string{},
},
},
+ {
+ description: "stars work with absolute paths",
+ artifact: &latest.Artifact{
+ ImageName: "test",
+ Sync: map[string]string{
+ "dir1a/***/*.js": "/tstar",
+ "dir1b/**/*.js": "/dstar",
+ },
+ Workspace: ".",
+ },
+ workingDir: "/some/dir",
+ builds: []build.Artifact{
+ {
+ ImageName: "test",
+ Tag: "test:123",
+ },
+ },
+ evt: watch.Events{
+ Added: []string{
+ filepath.Join("dir1a", "dir2/dir3/node.js"),
+ filepath.Join("dir1b", "dir2/dir3/node.js"),
+ },
+ },
+ expected: &Item{
+ Image: "test:123",
+ Copy: map[string]string{
+ filepath.Join("dir1a", "dir2/dir3/node.js"): "/tstar/dir2/dir3/node.js",
+ filepath.Join("dir1b", "dir2/dir3/node.js"): "/dstar/node.js",
+ },
+ Delete: map[string]string{},
+ },
+ },
}
for _, test := range tests {
