Skip to content

Commit

Permalink
add test which should fail if modes change
Browse files Browse the repository at this point in the history
  • Loading branch information
kmoe committed Apr 13, 2021
1 parent 4ddf87a commit 6baddc2
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions internal/provider/zip_archiver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,28 @@ func TestZipArchiver_FileMode(t *testing.T) {
}
}

func TestZipArchiver_FileMode_ShouldFail(t *testing.T) {
file, err := ioutil.TempFile("", "archive-file-mode-test.zip")
if err != nil {
t.Fatal(err)
}

var (
zipFilePath = file.Name()
toZipPath = filepath.FromSlash("./test-fixtures/test-file.txt")
)

stringArray := [5]string{"0444", "0644", "0666", "0744", "0777"}
for _, element := range stringArray {
archiver := NewZipArchiver(zipFilePath)
if err := archiver.ArchiveFile(toZipPath); err != nil {
t.Fatalf("unexpected error: %s", err)
}

ensureFileMode(t, zipFilePath, element)
}
}

func TestZipArchiver_FileModified(t *testing.T) {
var (
zipFilePath = filepath.FromSlash("archive-file.zip")
Expand Down

0 comments on commit 6baddc2

Please sign in to comment.