forked from KumoCorp/kumomta
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtsa-torture.js
More file actions
58 lines (51 loc) · 1.44 KB
/
Copy pathtsa-torture.js
File metadata and controls
58 lines (51 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// This is a k6 script that can be used to test the tsa-daemon publish endpoint
import http from "k6/http";
import encoding from "k6/encoding";
import { check } from "k6";
export const options = {
// How many concurrent connections should be established
vus: 100,
// How long the test should run for
duration: '30s',
};
export default function () {
const url = "http://127.0.0.1:8008/publish_log_v1";
const now = Math.floor(Date.now()/1000);
const content = {
"type": "TransientFailure",
"id": "1d98076abbbc11ed940250ebf67f93bd",
"sender": "user@example.com",
"recipient": "user@yahoo.com",
"queue": "something",
"site": "unspecified->(mta5|mta6|mta7).am0.yahoodns.net",
"size": 1024,
"response": {
"code": 421,
"enhanced_code": {
"class": 4,
"subject": 7,
"detail": 0
},
"content": "[TSS04] Messages from a.b.c.d temporarily deferred due to user complaints",
"command": "."
},
"timestamp": now,
"created": now,
"num_attempts": 1,
"bounce_classification": "Uncategorized",
"meta": {},
"headers": {},
"nodeid": "557f3ad4-2c8c-11ee-976e-782d7e12e173",
}
const payload = JSON.stringify(content);
const params = {
headers: {
"Content-Type": "application/json",
},
};
let response = http.post(url, payload, params);
// console.log(response);
check(response, {
"is status 200": (r) => r.status === 200,
});
}