5 changed files with 2029 additions and 0 deletions
@ -0,0 +1,8 @@
@@ -0,0 +1,8 @@
|
||||
# Tests |
||||
|
||||
## Load Tests |
||||
|
||||
1. Install [artillery](https://artillery.io/) from NPM/Yarn/Whatever Javascript package manager is popular this week. |
||||
1. Start an instance of the server on localhost. |
||||
1. `artillery run httpGetTest.yaml` for endpoint load tests. |
||||
1. `artillery run websocketTest.yaml` for websocket load tests. |
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
config: |
||||
target: 'http://localhost:8080/' |
||||
|
||||
ensure: |
||||
p95: 200 |
||||
maxErrorRate: 1 |
||||
|
||||
phases: |
||||
- duration: 60 |
||||
arrivalRate: 20 |
||||
scenarios: |
||||
- flow: |
||||
- get: |
||||
url: "/hls/stream.m3u8" |
||||
- get: |
||||
url: "/status" |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,14 @@
@@ -0,0 +1,14 @@
|
||||
module.exports = { createTestMessageObject }; |
||||
|
||||
function createTestMessageObject(userContext, events, done) { |
||||
const randomNumber = Math.floor((Math.random() * 10) + 1); |
||||
const author = "load-test-user-" + randomNumber |
||||
const data = { |
||||
author: author, |
||||
body: "Test 12345. " + randomNumber, |
||||
image: "https://robohash.org/" + author + "?size=80x80&set=set3" |
||||
}; |
||||
// set the "data" variable for the virtual user to use in the subsequent action
|
||||
userContext.vars.data = data; |
||||
return done(); |
||||
} |
@ -0,0 +1,24 @@
@@ -0,0 +1,24 @@
|
||||
config: |
||||
target: "ws://localhost:8080/entry" |
||||
processor: "./websocketTest.js" |
||||
|
||||
ensure: |
||||
p95: 200 |
||||
maxErrorRate: 1 |
||||
|
||||
phases: |
||||
- duration: 30 |
||||
arrivalRate: 10 |
||||
ws: |
||||
subprotocols: |
||||
- json |
||||
headers: |
||||
Connection: Upgrade |
||||
Origin: http://localhost:8080 |
||||
Sec-WebSocket-Version: 13 |
||||
scenarios: |
||||
- engine: "ws" |
||||
flow: |
||||
- function: "createTestMessageObject" |
||||
- send: "{{ data }}" |
||||
- think: 5 |
Loading…
Reference in new issue