From a68993d26ffaa1f9e54cfa3af0f680484df489ed Mon Sep 17 00:00:00 2001 From: k3nny Date: Fri, 26 Jun 2026 22:41:30 +0200 Subject: [PATCH] test(config): skip permission test when running as root The Gitea CI runner executes as root, which bypasses filesystem permission checks. The TestLoad_ReadError test creates a mode-0000 file and expects a read error, but root can always read files regardless of mode. Skip the test under root instead of removing it so it still runs in restricted environments. Co-Authored-By: Claude Sonnet 4.6 --- internal/config/config_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/config/config_test.go b/internal/config/config_test.go index a3918e4..e4ef7f5 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -103,6 +103,9 @@ func TestLoad_StopsAtGitRoot(t *testing.T) { // TestLoad_ReadError covers the !os.IsNotExist(err) branch (config.go:59-61) // when the file exists but is not readable. func TestLoad_ReadError(t *testing.T) { + if os.Getuid() == 0 { + t.Skip("skipping: root bypasses file permission checks") + } tmp := t.TempDir() cfgPath := filepath.Join(tmp, Filename) if err := os.WriteFile(cfgPath, []byte("ignore: []"), 0o000); err != nil {