From f7b16bad5c282c4a12029735f2aaddff01f01b58 Mon Sep 17 00:00:00 2001 From: Nuno Cruces Date: Mon, 16 Oct 2023 12:26:25 +0100 Subject: [PATCH] Patch flaky tests. --- sqlite_test.go | 7 +++++++ vfs/vfs_test.go | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/sqlite_test.go b/sqlite_test.go index 2f2b0cf..bd10cb2 100644 --- a/sqlite_test.go +++ b/sqlite_test.go @@ -3,6 +3,7 @@ package sqlite3 import ( "bytes" "math" + "os" "testing" "github.com/ncruces/go-sqlite3/internal/util" @@ -56,6 +57,12 @@ func Test_sqlite_new(t *testing.T) { }) t.Run("_MAX_ALLOCATION_SIZE", func(t *testing.T) { + if testing.Short() { + t.Skip("skipping in short mode") + } + if os.Getenv("CI") != "" { + t.Skip("skipping in CI") + } defer func() { _ = recover() }() sqlite.new(_MAX_ALLOCATION_SIZE) sqlite.new(_MAX_ALLOCATION_SIZE) diff --git a/vfs/vfs_test.go b/vfs/vfs_test.go index c17319c..043488d 100644 --- a/vfs/vfs_test.go +++ b/vfs/vfs_test.go @@ -7,6 +7,7 @@ import ( "io/fs" "math" "os" + "os/user" "path/filepath" "syscall" "testing" @@ -208,6 +209,10 @@ func Test_vfsAccess(t *testing.T) { t.Error("can't access file") } + if usr, err := user.Current(); err == nil && usr.Uid == "0" { + t.Skip("skipping as root") + } + util.WriteString(mod, 8, file) rc = vfsAccess(ctx, mod, 0, 8, ACCESS_READWRITE, 4) if rc != _OK {