aboutsummaryrefslogtreecommitdiff
path: root/tests/cli/cli_test.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2021-03-12 19:25:25 +0100
committerJakob Unterwurzacher2021-03-12 19:25:25 +0100
commit952d45ce84f63de963a1727e439e95883f9e65c1 (patch)
tree597027fcc77ea447318ee5ff7008cdfc63d160ec /tests/cli/cli_test.go
parentd47bf9976f1eab67e53aaeebbd6de02b69a39a09 (diff)
tests: add TestDiskFull
Also fix incomplete uid restoration in TestSupplementaryGroups and replace syscall.Setregid and friends with unix.Setregid and friends. This test is added to check if have problems handling a full disk. The ticket https://github.com/rfjakob/gocryptfs/issues/550 states that the full disk was not where the backing gocryptfs filesystem was, but this has no effect on gocryptfs, so we test the harder case.
Diffstat (limited to 'tests/cli/cli_test.go')
-rw-r--r--tests/cli/cli_test.go33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/cli/cli_test.go b/tests/cli/cli_test.go
index 23cea05..9d25062 100644
--- a/tests/cli/cli_test.go
+++ b/tests/cli/cli_test.go
@@ -9,6 +9,7 @@ import (
"os/exec"
"strconv"
"strings"
+ "sync"
"syscall"
"testing"
"time"
@@ -869,3 +870,35 @@ func TestSharedstorage(t *testing.T) {
t.Fatal(st2.Size)
}
}
+
+// Test that the filesystem is immediately ready for Creat() after mount returns
+func TestMountCreat(t *testing.T) {
+ const concurrency = 2
+ const repeat = 2
+
+ dir := test_helpers.InitFS(t)
+ mnt := dir + ".mnt"
+ err := os.Mkdir(mnt, 0700)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ for j := 0; j < repeat; j++ {
+ test_helpers.MountOrFatal(t, dir, mnt, "-extpass=echo test")
+ var wg sync.WaitGroup
+ wg.Add(concurrency)
+ for i := 0; i < concurrency; i++ {
+ go func(i int) {
+ path := fmt.Sprintf("%s/%d", mnt, i)
+ fd, err := syscall.Creat(path, 0600)
+ syscall.Close(fd)
+ if err != nil {
+ t.Errorf("Creat %q: %v", path, err)
+ }
+ wg.Done()
+ }(i)
+ }
+ wg.Wait()
+ test_helpers.UnmountPanic(mnt)
+ }
+}