refactor(server): rate limit and permission (#4198)

Co-authored-by: LongYinan <lynweklm@gmail.com>
This commit is contained in:
DarkSky
2023-09-08 05:32:41 +08:00
committed by GitHub
parent 4c4bb65be8
commit f4340da478
25 changed files with 555 additions and 272 deletions
@@ -8,6 +8,7 @@ import request from 'supertest';
import { AppModule } from '../app';
import {
checkBlobSize,
collectAllBlobSizes,
collectBlobSizes,
createWorkspace,
@@ -126,4 +127,20 @@ test('should calc all blobs size', async t => {
const size = await collectAllBlobSizes(app, u1.token.token);
t.is(size, 8, 'failed to collect all blob sizes');
const size1 = await checkBlobSize(
app,
u1.token.token,
workspace1.id,
10 * 1024 * 1024 * 1024 - 8
);
t.is(size1, 0, 'failed to check blob size');
const size2 = await checkBlobSize(
app,
u1.token.token,
workspace1.id,
10 * 1024 * 1024 * 1024 - 7
);
t.is(size2, -1, 'failed to check blob size');
});