diff options
author | Jakob Unterwurzacher | 2016-10-09 00:03:39 +0200 |
---|---|---|
committer | Jakob Unterwurzacher | 2016-10-09 00:03:39 +0200 |
commit | e220b24c5a2117eaec9882ee8d149faba6120731 (patch) | |
tree | c0a8e4d3af8af83a8e3cb6d13d5bd6080e7fc0bc /tests/normal | |
parent | dc4fdd8f44a9c54f20a13e576eeb140a636e9ee2 (diff) |
tests: add test for "mountpoint shadows cipherdir" logic
Diffstat (limited to 'tests/normal')
-rw-r--r-- | tests/normal/cli_test.go | 23 |
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") + } +} |