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

Function formatLoadTests

benchmarks/load-test.js:293–339  ·  view source on GitHub ↗

* Tests different response formats

(server)

Source from the content-addressed store, hash-verified

291 * Tests different response formats
292 */
293async function formatLoadTests (server) {
294 const baseUrl = `http://localhost:${server.server.address().port}`;
295
296 console.log("\n🔥 Response Format Load Tests");
297 console.log("=".repeat(50));
298
299 const tests = [
300 {
301 title: "JSON Format Test",
302 url: `${baseUrl}/users`,
303 headers: { "Accept": "application/json" },
304 connections: 20,
305 duration: 10
306 },
307 {
308 title: "XML Format Test",
309 url: `${baseUrl}/users`,
310 headers: { "Accept": "application/xml" },
311 connections: 20,
312 duration: 10
313 },
314 {
315 title: "CSV Format Test",
316 url: `${baseUrl}/users`,
317 headers: { "Accept": "text/csv" },
318 connections: 20,
319 duration: 10
320 },
321 {
322 title: "YAML Format Test",
323 url: `${baseUrl}/users`,
324 headers: { "Accept": "application/yaml" },
325 connections: 20,
326 duration: 10
327 }
328 ];
329
330 const results = [];
331 for (const test of tests) {
332 const result = await runLoadTest(test);
333 results.push({ ...test, result });
334
335 await new Promise(resolve => setTimeout(resolve, 1000));
336 }
337
338 return results;
339}
340
341/**
342 * Tests with rate limiting enabled

Callers 1

mainFunction · 0.85

Calls 2

runLoadTestFunction · 0.85
logMethod · 0.80

Tested by

no test coverage detected