aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/acl
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-04-07 15:18:28 +0900
committerOphestra <cat@gensokyo.uk>2026-04-07 15:22:52 +0900
commite4355279a1624833e36455a1a85788dbe091464e (patch)
tree7ba95bbd813f54cbabcaaf4cec5b004f8dbe72da /internal/acl
parent289fdebead872b1b011b8fe892d43a2f234703d1 (diff)
all: optionally forbid degrading in tests
This enables transparently degradable tests to be forced on in environments known to support them. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/acl')
-rw-r--r--internal/acl/acl_test.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/internal/acl/acl_test.go b/internal/acl/acl_test.go
index 5f5447ba..60c4b702 100644
--- a/internal/acl/acl_test.go
+++ b/internal/acl/acl_test.go
@@ -11,9 +11,11 @@ import (
"path/filepath"
"reflect"
"strconv"
+ "syscall"
"testing"
"hakurei.app/internal/acl"
+ "hakurei.app/internal/info"
)
const testFileName = "acl.test"
@@ -24,8 +26,14 @@ var (
)
func TestUpdate(t *testing.T) {
- if os.Getenv("HAKUREI_TEST_SKIP_ACL") == "1" {
- t.Skip("acl test skipped")
+ if info.CanDegrade {
+ name := filepath.Join(t.TempDir(), "check-degrade")
+ if err := os.WriteFile(name, nil, 0); err != nil {
+ t.Fatal(err)
+ }
+ if err := acl.Update(name, os.Geteuid()); errors.Is(err, syscall.ENOTSUP) {
+ t.Skip(err)
+ }
}
testFilePath := filepath.Join(t.TempDir(), testFileName)