aboutsummaryrefslogtreecommitdiff
path: root/integration_tests/example_filesystems_test.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2015-12-10 20:02:18 +0100
committerJakob Unterwurzacher2015-12-10 20:02:18 +0100
commit61ee2271c454047781afad6ded2e17e6efe20113 (patch)
treed2f6a45c34a6686b4247037b75671a89f861c68c /integration_tests/example_filesystems_test.go
parent29336ba61425240e89878049853e0bf4fbd5c148 (diff)
tests: test read-write directory operations on all example filesystems
Diffstat (limited to 'integration_tests/example_filesystems_test.go')
-rw-r--r--integration_tests/example_filesystems_test.go35
1 files changed, 19 insertions, 16 deletions
diff --git a/integration_tests/example_filesystems_test.go b/integration_tests/example_filesystems_test.go
index 69cbe0e..5eb34e0 100644
--- a/integration_tests/example_filesystems_test.go
+++ b/integration_tests/example_filesystems_test.go
@@ -13,8 +13,8 @@ const statusTxtContent = "It works!\n"
// checkStatusTxt - read file "filename" and verify that it contains
// "It works!\n"
-func checkExampleContent(t *testing.T, dir string) {
- // Check regular file
+func checkExampleFS(t *testing.T, dir string) {
+ // Read regular file
statusFile := filepath.Join(dir, "status.txt")
contentBytes, err := ioutil.ReadFile(statusFile)
if err != nil {
@@ -24,7 +24,7 @@ func checkExampleContent(t *testing.T, dir string) {
if content != statusTxtContent {
t.Errorf("Unexpected content: %s\n", content)
}
- // Check relative symlink
+ // Read relative symlink
symlink := filepath.Join(dir, "rel")
target, err := os.Readlink(symlink)
if err != nil {
@@ -33,7 +33,7 @@ func checkExampleContent(t *testing.T, dir string) {
if target != "status.txt" {
t.Errorf("Unexpected link target: %s\n", target)
}
- // Check absolute symlink
+ // Read absolute symlink
symlink = filepath.Join(dir, "abs")
target, err = os.Readlink(symlink)
if err != nil {
@@ -42,11 +42,14 @@ func checkExampleContent(t *testing.T, dir string) {
if target != "/a/b/c/d" {
t.Errorf("Unexpected link target: %s\n", target)
}
+ // Test directory operations
+ testRename(t, dir)
+ testMkdirRmdir(t, dir)
}
// Test example_filesystems/v0.4
// with password mount and -masterkey mount
-func TestExampleFsV04(t *testing.T) {
+func TestExampleFSv04(t *testing.T) {
pDir := tmpDir + "TestExampleFsV04/"
cDir := "example_filesystems/v0.4"
err := os.Mkdir(pDir, 0777)
@@ -54,11 +57,11 @@ func TestExampleFsV04(t *testing.T) {
t.Fatal(err)
}
mount(cDir, pDir, "-extpass", "echo test")
- checkExampleContent(t, pDir)
+ checkExampleFS(t, pDir)
unmount(pDir)
mount(cDir, pDir, "-masterkey", "74676e34-0b47c145-00dac61a-17a92316-"+
"bb57044c-e205b71f-65f4fdca-7cabd4b3", "-diriv=false", "-emenames=false")
- checkExampleContent(t, pDir)
+ checkExampleFS(t, pDir)
unmount(pDir)
err = os.Remove(pDir)
if err != nil {
@@ -68,7 +71,7 @@ func TestExampleFsV04(t *testing.T) {
// Test example_filesystems/v0.5
// with password mount and -masterkey mount
-func TestExampleFsV05(t *testing.T) {
+func TestExampleFSv05(t *testing.T) {
pDir := tmpDir + "TestExampleFsV05/"
cDir := "example_filesystems/v0.5"
err := os.Mkdir(pDir, 0777)
@@ -76,11 +79,11 @@ func TestExampleFsV05(t *testing.T) {
t.Fatal(err)
}
mount(cDir, pDir, "-extpass", "echo test")
- checkExampleContent(t, pDir)
+ checkExampleFS(t, pDir)
unmount(pDir)
mount(cDir, pDir, "-masterkey", "199eae55-36bff4af-83b9a3a2-4fa16f65-"+
"1549ccdb-2d08d1f0-b1b26965-1b61f896", "-emenames=false")
- checkExampleContent(t, pDir)
+ checkExampleFS(t, pDir)
unmount(pDir)
err = os.Remove(pDir)
if err != nil {
@@ -90,7 +93,7 @@ func TestExampleFsV05(t *testing.T) {
// Test example_filesystems/v0.6
// with password mount and -masterkey mount
-func TestExampleFsV06(t *testing.T) {
+func TestExampleFSv06(t *testing.T) {
pDir := tmpDir + "TestExampleFsV06/"
cDir := "example_filesystems/v0.6"
err := os.Mkdir(pDir, 0777)
@@ -98,11 +101,11 @@ func TestExampleFsV06(t *testing.T) {
t.Fatal(err)
}
mount(cDir, pDir, "-extpass", "echo test")
- checkExampleContent(t, pDir)
+ checkExampleFS(t, pDir)
unmount(pDir)
mount(cDir, pDir, "-masterkey", "7bc8deb0-5fc894ef-a093da43-61561a81-"+
"0e8dee83-fdc056a4-937c37dd-9df5c520")
- checkExampleContent(t, pDir)
+ checkExampleFS(t, pDir)
unmount(pDir)
err = os.Remove(pDir)
if err != nil {
@@ -112,7 +115,7 @@ func TestExampleFsV06(t *testing.T) {
// Test example_filesystems/v0.6
// with password mount and -masterkey mount
-func TestExampleFsV06PlaintextNames(t *testing.T) {
+func TestExampleFSv06PlaintextNames(t *testing.T) {
pDir := tmpDir + "TestExampleFsV06PlaintextNames/"
cDir := "example_filesystems/v0.6-plaintextnames"
err := os.Mkdir(pDir, 0777)
@@ -120,11 +123,11 @@ func TestExampleFsV06PlaintextNames(t *testing.T) {
t.Fatal(err)
}
mount(cDir, pDir, "-extpass", "echo test")
- checkExampleContent(t, pDir)
+ checkExampleFS(t, pDir)
unmount(pDir)
mount(cDir, pDir, "-masterkey", "f4690202-595e4593-64c4f7e0-4dddd7d1-"+
"303147f9-0ca8aea2-966341a7-52ea8ae9", "-plaintextnames")
- checkExampleContent(t, pDir)
+ checkExampleFS(t, pDir)
unmount(pDir)
err = os.Remove(pDir)
if err != nil {