Skip to content

Commit b2716ff

Browse files
committed
test(decomposedfs): assert a space manager may disable a project space
Since #672 a space manager may disable but not purge a project space. The "can delete (purge) project spaces" context asserts only the denial side ("fails as a space manager" purge); the positive counterpart, that a manager may still disable, was untested. A regression breaking manager disable would pass the suite unnoticed. Add the counterpart It: create a fresh project space and disable it as the space manager, expecting success (the shared space in BeforeEach is already disabled, so the test uses its own). Test-only, no production change.
1 parent 3d1ff52 commit b2716ff

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

pkg/storage/pkg/decomposedfs/spaces_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,17 @@ var _ = Describe("Spaces", func() {
203203
err := env.Fs.DeleteStorageSpace(ctx, delReq)
204204
Expect(err).To(HaveOccurred())
205205
})
206+
It("succeeds at disabling as a space manager", func() {
207+
// The positive counterpart to the purge denial above: since #672
208+
// a space manager may still disable (but not purge) a project
209+
// space. delReq's space is pre-disabled in BeforeEach, so use a
210+
// fresh one.
211+
resp, err := env.Fs.CreateStorageSpace(env.Ctx, &provider.CreateStorageSpaceRequest{Name: "Manager Disables", Type: "project"})
212+
Expect(err).ToNot(HaveOccurred())
213+
ctx := ctxpkg.ContextSetUser(context.Background(), env.SpaceManager)
214+
err = env.Fs.DeleteStorageSpace(ctx, &provider.DeleteStorageSpaceRequest{Id: resp.StorageSpace.GetId()})
215+
Expect(err).To(Not(HaveOccurred()))
216+
})
206217
// Reproducer for opencloud-eu/opencloud#2985: purging a space must
207218
// invalidate ALL of its msgpack indexes, not only the by-type index.
208219
// The by-user-id index keeps a stale entry pointing at the purged

0 commit comments

Comments
 (0)