@nocobase/test 2.0.0-alpha.27 → 2.0.0-alpha.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/perf/scenarios/blog/flow-login-list-create-list-with-delay.ts +1 -1
- package/perf/scenarios/express/create.ts +74 -0
- package/perf/scenarios/express/list-by-title-includes-page-appends_x100.ts +41 -0
- package/perf/scenarios/express/list-by-title-includes_x100.ts +40 -0
- /package/perf/{collections → scenarios/blog/collections}/categories.ts +0 -0
- /package/perf/{collections → scenarios/blog/collections}/comments.ts +0 -0
- /package/perf/{collections → scenarios/blog/collections}/posts.ts +0 -0
- /package/perf/{collections → scenarios/blog/collections}/tags.ts +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/test",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.29",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"module": "./src/index.ts",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"@faker-js/faker": "8.1.0",
|
|
54
|
-
"@nocobase/server": "2.0.0-alpha.
|
|
54
|
+
"@nocobase/server": "2.0.0-alpha.29",
|
|
55
55
|
"@playwright/test": "^1.45.3",
|
|
56
56
|
"@testing-library/jest-dom": "^6.4.2",
|
|
57
57
|
"@testing-library/react": "^14.0.0",
|
|
@@ -75,5 +75,5 @@
|
|
|
75
75
|
"vitest-dom": "^0.1.1",
|
|
76
76
|
"ws": "^8.13.0"
|
|
77
77
|
},
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "58961a6fbb9fe07572d863cf7119a1636011deae"
|
|
79
79
|
}
|
|
@@ -15,7 +15,7 @@ export const options = {
|
|
|
15
15
|
// 10min
|
|
16
16
|
{ target: 100, duration: '30s' },
|
|
17
17
|
{ target: 200, duration: '30s' },
|
|
18
|
-
{ target: 200, duration: '
|
|
18
|
+
{ target: 200, duration: '3m' },
|
|
19
19
|
{ target: 100, duration: '30s' },
|
|
20
20
|
{ target: 0, duration: '30s' },
|
|
21
21
|
],
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// __benchmarks__/k6/write-single.js
|
|
2
|
+
import http from 'k6/http';
|
|
3
|
+
import { check, sleep } from 'k6';
|
|
4
|
+
|
|
5
|
+
// export { setup } from './setup.js';
|
|
6
|
+
|
|
7
|
+
export const options = {
|
|
8
|
+
stages: [
|
|
9
|
+
{ duration: '1s', target: 100 },
|
|
10
|
+
{ duration: '59s', target: 100 },
|
|
11
|
+
],
|
|
12
|
+
thresholds: {
|
|
13
|
+
http_req_duration: ['p(95)<500'], // 95% 请求 < 500ms
|
|
14
|
+
http_req_failed: ['rate<0.01'], // 失败率 < 1%
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default function () {
|
|
19
|
+
const url = `${__ENV.TARGET_ORIGIN}/posts`;
|
|
20
|
+
const params = {
|
|
21
|
+
headers: {
|
|
22
|
+
'Content-Type': 'application/json',
|
|
23
|
+
// Authorization: `Bearer ${token}`,
|
|
24
|
+
// 'X-Role': 'admin',
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
const payload = JSON.stringify({
|
|
28
|
+
title: `Title ${__VU}-${__ITER} ${Math.random().toString(36)}`,
|
|
29
|
+
content: 'Some content',
|
|
30
|
+
categoryId: 1,
|
|
31
|
+
tags: [1, 2],
|
|
32
|
+
publishedAt: new Date().toISOString(),
|
|
33
|
+
status: 'published',
|
|
34
|
+
allowComments: true,
|
|
35
|
+
featured: false,
|
|
36
|
+
viewCount: Math.floor(Math.random() * 1000),
|
|
37
|
+
excerpt: 'This is a short excerpt of the post.',
|
|
38
|
+
musicUrl: 'https://example.com/music.mp3',
|
|
39
|
+
coverImage: 'https://example.com/cover.jpg',
|
|
40
|
+
slug: `title-${__VU}-${__ITER}-${Math.random().toString(36)}`,
|
|
41
|
+
read: 1,
|
|
42
|
+
score: 4.5,
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const res = http.post(url, payload, params);
|
|
46
|
+
|
|
47
|
+
check(res, {
|
|
48
|
+
'status is 201': (r) => {
|
|
49
|
+
if (r.status !== 201) {
|
|
50
|
+
console.log('status:', r.status);
|
|
51
|
+
}
|
|
52
|
+
return r.status === 201;
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// export function teardown({ token }) {
|
|
58
|
+
// const url = `${__ENV.TARGET_ORIGIN}/api/posts:destroy`;
|
|
59
|
+
// const params = {
|
|
60
|
+
// headers: {
|
|
61
|
+
// 'Content-Type': 'application/json',
|
|
62
|
+
// Authorization: `Bearer ${token}`,
|
|
63
|
+
// },
|
|
64
|
+
// queries: {
|
|
65
|
+
// filter: JSON.stringify({ id: { $gt: 1000000 } }),
|
|
66
|
+
// },
|
|
67
|
+
// };
|
|
68
|
+
|
|
69
|
+
// let res = http.delete(url, params);
|
|
70
|
+
|
|
71
|
+
// check(res, {
|
|
72
|
+
// 'status is 200': (r) => r.status === 200,
|
|
73
|
+
// });
|
|
74
|
+
// }
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// __benchmarks__/k6/write-single.js
|
|
2
|
+
import http from 'k6/http';
|
|
3
|
+
import { check, sleep } from 'k6';
|
|
4
|
+
|
|
5
|
+
import { uid } from '../../utils.js';
|
|
6
|
+
// export { setup } from './setup.js';
|
|
7
|
+
|
|
8
|
+
export const options = {
|
|
9
|
+
stages: [
|
|
10
|
+
// { duration: '1s', target: 1 },
|
|
11
|
+
{ duration: '1s', target: 100 },
|
|
12
|
+
{ duration: '59s', target: 100 },
|
|
13
|
+
],
|
|
14
|
+
thresholds: {
|
|
15
|
+
http_req_duration: ['p(95)<400'], // 95% 请求 < 400ms
|
|
16
|
+
http_req_failed: ['rate<0.01'], // 失败率 < 1%
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default function () {
|
|
21
|
+
const keyword = uid(2);
|
|
22
|
+
const url = `${__ENV.TARGET_ORIGIN}/posts?filter=${JSON.stringify({
|
|
23
|
+
title: { $iLike: `${keyword}%` },
|
|
24
|
+
})}&sort=-createdAt&pageSize=50&page=${Math.floor(Math.random() * 200) + 1}&appends[]=category&appends[]=tags`;
|
|
25
|
+
const params = {
|
|
26
|
+
headers: {
|
|
27
|
+
'Content-Type': 'application/json',
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const res = http.get(url, params);
|
|
32
|
+
|
|
33
|
+
check(res, {
|
|
34
|
+
'status is 200': (r) => r.status === 200,
|
|
35
|
+
'has data': (r) => {
|
|
36
|
+
return r.json().length > 1;
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
sleep(1);
|
|
41
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// __benchmarks__/k6/write-single.js
|
|
2
|
+
import http from 'k6/http';
|
|
3
|
+
import { check, sleep } from 'k6';
|
|
4
|
+
|
|
5
|
+
import { uid } from '../../utils.js';
|
|
6
|
+
// export { setup } from './setup.js';
|
|
7
|
+
|
|
8
|
+
export const options = {
|
|
9
|
+
stages: [
|
|
10
|
+
{ duration: '1s', target: 100 },
|
|
11
|
+
{ duration: '59s', target: 100 },
|
|
12
|
+
],
|
|
13
|
+
thresholds: {
|
|
14
|
+
http_req_duration: ['p(95)<500'], // 95% 请求 < 200ms
|
|
15
|
+
http_req_failed: ['rate<0.01'], // 失败率 < 1%
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default function () {
|
|
20
|
+
const keyword = uid(2);
|
|
21
|
+
const url = `${__ENV.TARGET_ORIGIN}/posts`;
|
|
22
|
+
const params = {
|
|
23
|
+
headers: {
|
|
24
|
+
'Content-Type': 'application/json',
|
|
25
|
+
},
|
|
26
|
+
queries: {
|
|
27
|
+
filter: JSON.stringify({ title: { $iLike: keyword } }),
|
|
28
|
+
sort: '-createdAt',
|
|
29
|
+
pageSize: 50,
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const res = http.get(url, params);
|
|
34
|
+
|
|
35
|
+
check(res, {
|
|
36
|
+
'status is 200': (r) => r.status === 200,
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// sleep(1);
|
|
40
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|