-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLoadTestFunction.js
More file actions
31 lines (23 loc) · 907 Bytes
/
LoadTestFunction.js
File metadata and controls
31 lines (23 loc) · 907 Bytes
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
'use strict'
function generateUniqueCode() {
const timestamp = Date.now().toString(36); // Convert current timestamp to base36 string
const randomString = Math.random().toString(36).substring(5, 10); // Generate a random string
return timestamp + randomString;
}
function generateUserId() {
const user_id = Math.floor(Math.random() * 10000) + 1; // Generate a random user id
return user_id.toString();
}
const generateMessages = (userContext, events, done) => {
userContext.vars.from = "sender@example.com"
userContext.vars.to = "success@simulator.amazonses.com"
userContext.vars.template_name = "SimpleEmail"
userContext.vars.user_id = generateUserId()
userContext.vars.config_set = "load-test-config"
userContext.vars.tags = [{"Name":"campaign","Value":"run1"}]
userContext.vars.unique_code = generateUniqueCode()
return done()
}
module.exports = {
generateMessages
}