From 8e4ede6f96ed40c5026f5ae1327db24e3774a0d3 Mon Sep 17 00:00:00 2001 From: jochen Date: Wed, 25 Nov 2026 18:57:09 +0100 Subject: [PATCH] H2 owner-pass-with-units-stopped: the pass-back row keeps a placed child, another user's entry and a file with two links Builds: design 47 H2 H-A-602 (the pass back), AC-H2a, AC-H3 --- internal/apply/contents_owner_test.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/internal/apply/contents_owner_test.go b/internal/apply/contents_owner_test.go index ba688f5f..a7f5cfc6 100644 --- a/internal/apply/contents_owner_test.go +++ b/internal/apply/contents_owner_test.go @@ -42,8 +42,9 @@ func TestADirectoryGivesItsContentsTheNewOwner(t *testing.T) { want: []string{"data", "data/repo", "link", "token"}}, {name: "an entry with two hard links is left with its owner, and said", from: [2]int{me, myGroup}, linked: true, want: []string{"data", "data/repo", "kept", "kept/webhook.secret", "link"}}, - {name: "given back to the earlier account it keeps the same three: the user, the group only where it was the new one's, the rest left", - from: [2]int{me, myGroup}, back: true, want: []string{"data", "data/repo", "kept", "kept/webhook.secret", "link", "token"}}, + {name: "given back to the earlier account it keeps the same three: a placed child, an entry of another user, a file with two links", + from: [2]int{me, myGroup}, back: true, linked: true, + placed: func(root string) []string { return []string{filepath.Join(root, "data")} }, want: []string{"link"}}, } for _, c := range cases { t.Run(c.name, func(t *testing.T) { @@ -78,9 +79,14 @@ func TestADirectoryGivesItsContentsTheNewOwner(t *testing.T) { wantGroup := to[1] from, target := c.from, to if c.back { - // What the pass gave is now owned by the new account: every entry reads as to's, and goes back to c.from. + // What the pass gave is now owned by the new account: every entry but kept reads as to's, and goes back to c.from. from, target, wantGroup = to, c.from, c.from[1] - ownerRead = func(os.FileInfo) (int, int, bool) { return to[0], to[1], true } + ownerRead = func(info os.FileInfo) (int, int, bool) { + if info.Name() == "kept" { // another user's entry, and what lies below it + return to[0] + 1, to[1], true + } + return to[0], to[1], true + } defer func() { ownerRead = statOwner }() } if c.group != 0 {