Skip to content

test(decomposedfs): purge project spaces as a delete-all-spaces user - #709

Closed
michaelstingl wants to merge 1 commit into
opencloud-eu:mainfrom
michaelstingl:fix/space-deletion-permission-tests
Closed

michaelstingl wants to merge 1 commit into
opencloud-eu:mainfrom
michaelstingl:fix/space-deletion-permission-tests

Conversation

@michaelstingl

Copy link
Copy Markdown

Description

Three tests in pkg/storage/pkg/decomposedfs/spaces_test.go (the "can delete (purge) project spaces" context) purge a project space as its owner, a space manager, and assert success:

  • removes the space from the by-user-id index
  • removes the space from the by-user-id and by-group indexes for grantees
  • keeps a sibling space in the by-user-id index when another is purged

A space manager may disable a project space but not purge it; only a delete-all-spaces user may purge. canDeleteSpace now denies the purge, so the three tests fail on main with permission denied: user is not allowed to delete space ....

This change purges as a delete-all-spaces user instead, the same actor the sibling succeeds as a user with 'delete-all-spaces privilege test already uses. It also adds the missing counterpart assertion: a space manager can still disable a project space. The change is limited to tests, with no production code change.

Related Issue

No issue to close. This change realigns the tests with the permission model from #672. The tests were added in #695, which predated that restriction.

Motivation and Context

The decomposedfs package currently fails on main: these three tests return permission denied, which blocks a clean CI run on every reva pull request. This change restores the package to passing and covers both sides of the space-manager permission, disable allowed and purge denied.

How Has This Been Tested?

  • test environment: golang:1.25 container, source on an ext4 volume for user.* xattr support (the native macOS filesystem is unreliable for these decomposedfs tests)
  • go test ./pkg/storage/pkg/decomposedfs/: red on main for the three tests, green with this change, including the new space-manager-disable assertion
  • gofmt, go vet and golangci-lint v2.10.1: clean on the package

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation added (n/a: reva builds the changelog from the PR title and Type:* label via ready-release-go, so no fragment is needed)

cc @aduffeck, familiar with both #672 and #695.

🤖 drafted with Claude Code, reviewed before submitting.

Three tests in the "can delete (purge) project spaces" context purge a
project space as its owner (a space manager) and expect success. A space
manager may disable but not purge a project space; only a
delete-all-spaces user can. So these tests fail on main with
"permission denied".

Purge as a delete-all-spaces user, the same actor the sibling
"succeeds as delete-all-spaces" test already uses. Also assert that a
space manager can disable a project space, the counterpart to the
existing "fails as a space manager" purge test. Test-only, no production
change.
@rhafer

rhafer commented Jul 6, 2026

Copy link
Copy Markdown
Member

@michaelstingl I guess this was fixed already with #716? Is this still needed?

@michaelstingl

Copy link
Copy Markdown
Author

Yes. #716 fixes all three purge tests the same way this PR does (purge as env.DeleteAllSpacesUser), so the core here is redundant and the branch now conflicts with main. Closing this one.

#716 did not carry over one thing: a positive counterpart to fails as a space manager, asserting that a manager may still disable (not purge) a project space since #672. main covers only the purge-denial side. That assertion now lives in #730 so it applies cleanly on green main. Take it or leave it there.

🤖 drafted with Claude Code, reviewed before submitting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants