Skip to content

Commit

Permalink
Add test for #386
Browse files Browse the repository at this point in the history
Signed-off-by: David Gageot <david@gageot.net>
  • Loading branch information
dgageot committed May 17, 2018
1 parent c6b1701 commit 7468876
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/skaffold/docker/context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ func TestDockerContext(t *testing.T) {
os.Mkdir(filepath.Join(tmpDir, "files"), 0750)
ioutil.WriteFile(filepath.Join(tmpDir, "files", "ignored.txt"), []byte(""), 0644)
ioutil.WriteFile(filepath.Join(tmpDir, "files", "included.txt"), []byte(""), 0644)
ioutil.WriteFile(filepath.Join(tmpDir, ".dockerignore"), []byte("**/ignored.txt"), 0644)
ioutil.WriteFile(filepath.Join(tmpDir, ".dockerignore"), []byte("**/ignored.txt\nalsoignored.txt"), 0644)
ioutil.WriteFile(filepath.Join(tmpDir, "Dockerfile"), []byte("FROM alpine\nCOPY ./files /files"), 0644)
ioutil.WriteFile(filepath.Join(tmpDir, "ignored.txt"), []byte(""), 0644)
ioutil.WriteFile(filepath.Join(tmpDir, "alsoignored.txt"), []byte(""), 0644)

reader, writer := io.Pipe()
go func() {
Expand Down Expand Up @@ -65,6 +66,9 @@ func TestDockerContext(t *testing.T) {
if files["ignored.txt"] {
t.Error("File ignored.txt should have been excluded, but was not")
}
if files["alsoignored.txt"] {
t.Error("File alsoignored.txt should have been excluded, but was not")
}
if files["files/ignored.txt"] {
t.Error("File files/ignored.txt should have been excluded, but was not")
}
Expand Down

0 comments on commit 7468876

Please sign in to comment.