Skip to content

Commit

Permalink
tests: add test for "mountpoint shadows cipherdir" logic
Browse files Browse the repository at this point in the history
  • Loading branch information
rfjakob committed Oct 8, 2016
1 parent dc4fdd8 commit e220b24
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/normal/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}

0 comments on commit e220b24

Please sign in to comment.