* Basic load tests
(server)
| 177 | * Basic load tests |
| 178 | */ |
| 179 | async function basicLoadTests (server) { |
| 180 | const baseUrl = `http://localhost:${server.server.address().port}`; |
| 181 | |
| 182 | console.log("\n🔥 Basic Load Tests"); |
| 183 | console.log("=".repeat(50)); |
| 184 | |
| 185 | const tests = [ |
| 186 | { |
| 187 | title: "Simple Ping Test (Low Load)", |
| 188 | url: `${baseUrl}/ping`, |
| 189 | connections: 10, |
| 190 | duration: 10 |
| 191 | }, |
| 192 | { |
| 193 | title: "Simple Ping Test (Medium Load)", |
| 194 | url: `${baseUrl}/ping`, |
| 195 | connections: 50, |
| 196 | duration: 10 |
| 197 | }, |
| 198 | { |
| 199 | title: "Simple Ping Test (High Load)", |
| 200 | url: `${baseUrl}/ping`, |
| 201 | connections: 100, |
| 202 | duration: 10 |
| 203 | }, |
| 204 | { |
| 205 | title: "JSON Response Test", |
| 206 | url: `${baseUrl}/users`, |
| 207 | connections: 25, |
| 208 | duration: 10 |
| 209 | }, |
| 210 | { |
| 211 | title: "Large JSON Response Test", |
| 212 | url: `${baseUrl}/large`, |
| 213 | connections: 10, |
| 214 | duration: 10 |
| 215 | } |
| 216 | ]; |
| 217 | |
| 218 | const results = []; |
| 219 | for (const test of tests) { |
| 220 | const result = await runLoadTest(test); |
| 221 | results.push({ ...test, result }); |
| 222 | |
| 223 | // Brief pause between tests |
| 224 | await new Promise(resolve => setTimeout(resolve, 1000)); |
| 225 | } |
| 226 | |
| 227 | return results; |
| 228 | } |
| 229 | |
| 230 | /** |
| 231 | * POST request load tests |
no test coverage detected