feat(server): separate storage quota limit and blob size limit (#10957)

close CLOUD-171
This commit is contained in:
fengmk2
2025-03-18 09:28:50 +00:00
parent 86c4e0705f
commit 4fc3e92205
9 changed files with 48 additions and 14 deletions

View File

@@ -143,10 +143,12 @@ test('should reject blob exceeded limit', async t => {
const buffer1 = Buffer.from(
Array.from({ length: RESTRICTED_QUOTA.blobLimit + 1 }, () => 0)
);
await t.throwsAsync(setBlob(app, workspace1.id, buffer1));
await t.throwsAsync(setBlob(app, workspace1.id, buffer1), {
message: 'You have exceeded your blob size quota.',
});
});
test('should reject blob exceeded quota', async t => {
test('should reject blob exceeded storage quota', async t => {
await app.signupV1('u1@affine.pro');
const workspace = await createWorkspace(app);
@@ -155,7 +157,9 @@ test('should reject blob exceeded quota', async t => {
const buffer = Buffer.from(Array.from({ length: OneMB }, () => 0));
await t.notThrowsAsync(setBlob(app, workspace.id, buffer));
await t.throwsAsync(setBlob(app, workspace.id, buffer));
await t.throwsAsync(setBlob(app, workspace.id, buffer), {
message: 'You have exceeded your storage quota.',
});
});
test('should accept blob even storage out of quota if workspace has unlimited feature', async t => {