aboutsummaryrefslogtreecommitdiff
path: root/tests/normal/cli_test.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2016-10-09 00:03:39 +0200
committerJakob Unterwurzacher2016-10-09 00:03:39 +0200
commite220b24c5a2117eaec9882ee8d149faba6120731 (patch)
treec0a8e4d3af8af83a8e3cb6d13d5bd6080e7fc0bc /tests/normal/cli_test.go
parentdc4fdd8f44a9c54f20a13e576eeb140a636e9ee2 (diff)
tests: add test for "mountpoint shadows cipherdir" logic
Diffstat (limited to 'tests/normal/cli_test.go')
-rw-r--r--tests/normal/cli_test.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/normal/cli_test.go b/tests/normal/cli_test.go
index 6691822..bbb45ae 100644
--- a/tests/normal/cli_test.go
+++ b/tests/normal/cli_test.go
@@ -168,3 +168,26 @@ func TestNonempty(t *testing.T) {
test_helpers.MountOrFatal(t, dir, mnt, "-nonempty", "-extpass=echo test")
test_helpers.UnmountPanic(mnt)
}
+
+// Test "mountpoint shadows cipherdir" handling
+func TestShadows(t *testing.T) {
+ mnt := test_helpers.InitFS(t)
+ cipher := mnt + ".cipher"
+ err := os.Rename(mnt, cipher)
+ if err != nil {
+ t.Fatal(err)
+ }
+ // This should work
+ test_helpers.MountOrFatal(t, cipher, mnt, "-extpass=echo test")
+ test_helpers.UnmountPanic(mnt)
+ cipher2 := mnt + "/cipher"
+ err = os.Rename(cipher, cipher2)
+ if err != nil {
+ t.Fatal(err)
+ }
+ // This should fail
+ err = test_helpers.Mount(cipher2, mnt, false, "-extpass=echo test")
+ if err == nil {
+ t.Errorf("Should have failed")
+ }
+}