diff --git a/integration_tests/example_filesystems/normal/6hL2fPVB2aMSh4-UoDn5Kw== b/integration_tests/example_filesystems/normal/6hL2fPVB2aMSh4-UoDn5Kw== new file mode 120000 index 0000000..31b9013 --- /dev/null +++ b/integration_tests/example_filesystems/normal/6hL2fPVB2aMSh4-UoDn5Kw== @@ -0,0 +1 @@ +3-HZSwv99agoWgTErV0YFQ== \ No newline at end of file diff --git a/integration_tests/example_filesystems/normal/TBIgdfhDKwkXVTnWLVzFSg== b/integration_tests/example_filesystems/normal/TBIgdfhDKwkXVTnWLVzFSg== new file mode 120000 index 0000000..7a15694 --- /dev/null +++ b/integration_tests/example_filesystems/normal/TBIgdfhDKwkXVTnWLVzFSg== @@ -0,0 +1 @@ +/tTXhw8tmmz4PK9YG21Whug==/Qe8z0HUArb5bZJjUqEo2Nw==/wv68UB9DLF9OfAcxgRKKtQ==/9No5n3deBUGa-BsvPRi3DQ== \ No newline at end of file diff --git a/integration_tests/example_filesystems_test.go b/integration_tests/example_filesystems_test.go index 7924736..bd4f21d 100644 --- a/integration_tests/example_filesystems_test.go +++ b/integration_tests/example_filesystems_test.go @@ -3,6 +3,7 @@ package integration_tests // Mount example filesystems and check that the file "status.txt" is there import ( + "path/filepath" "io/ioutil" "os" "testing" @@ -12,8 +13,10 @@ const statusTxtContent = "It works!\n" // checkStatusTxt - read file "filename" and verify that it contains // "It works!\n" -func checkStatusTxt(t *testing.T, filename string) { - contentBytes, err := ioutil.ReadFile(filename) +func checkExampleContent(t *testing.T, dir string) { + // Check regular file + statusFile := filepath.Join(dir, "status.txt") + contentBytes, err := ioutil.ReadFile(statusFile) if err != nil { t.Fatal(err) } @@ -21,6 +24,24 @@ func checkStatusTxt(t *testing.T, filename string) { if content != statusTxtContent { t.Errorf("Unexpected content: %s\n", content) } + // Check relative symlink + symlink := filepath.Join(dir, "rel") + target, err := os.Readlink(symlink) + if err != nil { + t.Fatal(err) + } + if target != "status.txt" { + t.Errorf("Unexpected link target: %s\n", target) + } + // Check absolute symlink + symlink = filepath.Join(dir, "abs") + target, err = os.Readlink(symlink) + if err != nil { + t.Fatal(err) + } + if target != "/a/b/c/d" { + t.Errorf("Unexpected link target: %s\n", target) + } } // Test example_filesystems/normal @@ -33,11 +54,11 @@ func TestExampleFsNormal(t *testing.T) { t.Fatal(err) } mount(cDir, pDir, "-extpass", "echo test") - checkStatusTxt(t, pDir+"status.txt") + checkExampleContent(t, pDir) unmount(pDir) mount(cDir, pDir, "-masterkey", "74676e34-0b47c145-00dac61a-17a92316-"+ "bb57044c-e205b71f-65f4fdca-7cabd4b3", "-diriv=false") - checkStatusTxt(t, pDir+"status.txt") + checkExampleContent(t, pDir) unmount(pDir) err = os.Remove(pDir) if err != nil {