all: optionally forbid degrading in tests
Some checks failed
Test / Create distribution (push) Successful in 1m19s
Test / Sandbox (push) Successful in 3m9s
Test / Flake checks (push) Has been cancelled
Test / Hakurei (race detector) (push) Has been cancelled
Test / Sandbox (race detector) (push) Has been cancelled
Test / ShareFS (push) Has been cancelled
Test / Hakurei (push) Has been cancelled

This enables transparently degradable tests to be forced on in environments known to support them.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-04-07 15:18:28 +09:00
parent 289fdebead
commit 25b7bedaf1
8 changed files with 32 additions and 15 deletions

View File

@@ -11,9 +11,11 @@ import (
"path/filepath"
"reflect"
"strconv"
"syscall"
"testing"
"hakurei.app/internal/acl"
"hakurei.app/internal/info"
)
const testFileName = "acl.test"
@@ -24,10 +26,6 @@ var (
)
func TestUpdate(t *testing.T) {
if os.Getenv("HAKUREI_TEST_SKIP_ACL") == "1" {
t.Skip("acl test skipped")
}
testFilePath := filepath.Join(t.TempDir(), testFileName)
if f, err := os.Create(testFilePath); err != nil {
@@ -43,6 +41,12 @@ func TestUpdate(t *testing.T) {
}
}()
if info.CanDegrade {
if err := acl.Update(testFilePath, os.Geteuid()); errors.Is(err, syscall.ENOTSUP) {
t.Skip(err)
}
}
cur := getfacl(t, testFilePath)
t.Run("default entry count", func(t *testing.T) {