Skip to content

Commit

Permalink
test: add test case for symlinks; update testdata
Browse files Browse the repository at this point in the history
Signed-off-by: Steven White <swhitewvu24@gmail.com>
  • Loading branch information
swhite24 committed Nov 2, 2022
1 parent 6b2178c commit cd2ce01
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
16 changes: 14 additions & 2 deletions workflow/executor/executor_test.go
Expand Up @@ -277,18 +277,30 @@ func TestUnzip(t *testing.T) {

func TestUntar(t *testing.T) {
tarPath := "testdata/file.tar.gz"
destPath := "testdata/untarredFile"
destPath := "testdata/untarredDir"
filePath := "testdata/untarredDir/file"
linkPath := "testdata/untarredDir/link"

// test
err := untar(tarPath, destPath)
assert.NoError(t, err)

// check untarred file
// check untarred contents
fileInfo, err := os.Stat(destPath)
assert.NoError(t, err)
assert.True(t, fileInfo.Mode().IsDir())
fileInfo, err = os.Stat(filePath)
assert.NoError(t, err)
assert.True(t, fileInfo.Mode().IsRegular())
fileInfo, err = os.Stat(linkPath)
assert.NoError(t, err)
assert.True(t, fileInfo.Mode().IsRegular())

// cleanup
err = os.Remove(linkPath)
assert.NoError(t, err)
err = os.Remove(filePath)
assert.NoError(t, err)
err = os.Remove(destPath)
assert.NoError(t, err)
}
Expand Down
Binary file modified workflow/executor/testdata/file.tar.gz
Binary file not shown.
1 change: 1 addition & 0 deletions workflow/executor/testdata/link

0 comments on commit cd2ce01

Please sign in to comment.