MCPcopy Create free account
hub / github.com/avoidwork/tenso / postLoadTests

Function postLoadTests

benchmarks/load-test.js:233–288  ·  view source on GitHub ↗

* POST request load tests

(server)

Source from the content-addressed store, hash-verified

231 * POST request load tests
232 */
233async function postLoadTests (server) {
234 const baseUrl = `http://localhost:${server.server.address().port}`;
235
236 console.log("\n🔥 POST Request Load Tests");
237 console.log("=".repeat(50));
238
239 const tests = [
240 {
241 title: "Small POST Body Test",
242 url: `${baseUrl}/echo`,
243 method: "POST",
244 body: { message: "Hello World", timestamp: Date.now() },
245 connections: 25,
246 duration: 10
247 },
248 {
249 title: "Medium POST Body Test",
250 url: `${baseUrl}/echo`,
251 method: "POST",
252 body: {
253 users: Array.from({ length: 50 }, (_, i) => ({
254 id: i,
255 name: `User ${i}`,
256 active: i % 2 === 0
257 }))
258 },
259 connections: 15,
260 duration: 10
261 },
262 {
263 title: "Large POST Body Test",
264 url: `${baseUrl}/echo`,
265 method: "POST",
266 body: {
267 items: Array.from({ length: 200 }, (_, i) => ({
268 id: i,
269 title: `Item ${i}`,
270 description: `Description for item ${i}`.repeat(5),
271 metadata: { created: Date.now(), tags: [`tag${i}`] }
272 }))
273 },
274 connections: 10,
275 duration: 10
276 }
277 ];
278
279 const results = [];
280 for (const test of tests) {
281 const result = await runLoadTest(test);
282 results.push({ ...test, result });
283
284 await new Promise(resolve => setTimeout(resolve, 1000));
285 }
286
287 return results;
288}
289
290/**

Callers 1

mainFunction · 0.85

Calls 2

runLoadTestFunction · 0.85
logMethod · 0.80

Tested by

no test coverage detected