diff options
| author | Jakob Unterwurzacher | 2015-11-28 20:21:06 +0100 | 
|---|---|---|
| committer | Jakob Unterwurzacher | 2015-11-28 20:21:06 +0100 | 
| commit | 8766ab5472bcd3f70cc4caedc83d68cbd8155283 (patch) | |
| tree | 982952481e6c3143b7c67b68ddc0b92a47b7e432 /integration_tests | |
| parent | 1fb349e97b5972b5d56c61afd05aed26698dcc97 (diff) | |
tests: verify that symlinks work
Diffstat (limited to 'integration_tests')
3 files changed, 27 insertions, 4 deletions
| 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 { | 
