tests: reverse: add ctlsocket cleanup delay

This commit is contained in:
Jakob Unterwurzacher 2019-01-01 22:54:41 +01:00
parent 035834dd51
commit 035b3367b7
2 changed files with 11 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import (
"io/ioutil"
"syscall"
"testing"
"time"
"github.com/rfjakob/gocryptfs/internal/ctlsock"
"github.com/rfjakob/gocryptfs/tests/test_helpers"
@ -67,6 +68,9 @@ func TestCtlSockPathOps(t *testing.T) {
if response.ErrNo != int32(syscall.ENOENT) {
t.Errorf("File should not exist: ErrNo=%d ErrText=%s", response.ErrNo, response.ErrText)
}
// Give the running gocryptfs process a little bit of time to close lingering
// sockets. Avoid triggering the FD leak detector.
time.Sleep(1 * time.Millisecond)
}
// We should not panic when somebody feeds requests that make no sense
@ -85,4 +89,7 @@ func TestCtlSockCrash(t *testing.T) {
// Try to crash it
req := ctlsock.RequestStruct{DecryptPath: "gocryptfs.longname.XXX_TestCtlSockCrash_XXX.name"}
test_helpers.QueryCtlSock(t, sock, req)
// Give the running gocryptfs process a little bit of time to close lingering
// sockets. Avoid triggering the FD leak detector.
time.Sleep(1 * time.Millisecond)
}

View File

@ -3,6 +3,7 @@ package reverse_test
import (
"io/ioutil"
"testing"
"time"
"github.com/rfjakob/gocryptfs/internal/ctlsock"
"github.com/rfjakob/gocryptfs/tests/test_helpers"
@ -101,6 +102,9 @@ func testExclude(t *testing.T, flag string) {
t.Errorf("File %q / %q is hidden, but should be visible", pOk[i], v)
}
}
// Give the running gocryptfs process a little bit of time to close lingering
// sockets. Avoid triggering the FD leak detector.
time.Sleep(1 * time.Millisecond)
}
func TestExclude(t *testing.T) {