Use CircleCI version 2.1 at the top of your .circleci/config.yml file.
1
version: 2.1
Add the orbs
stanza below your version, invoking the orb:
1
2
orbs:
loadtest: neocortix/loadtest@0.5.1
Use loadtest
elements in your existing workflows and jobs.
Opt-in to use of uncertified orbs on your organization’s Security settings page.
This simple python-oriented example does a small loadtest using a command based on the orb. To use this orb, you need to define a $NCS_AUTH_TOKEN environment variable.
1
2
3
4
5
6
7
8
9
10
jobs:
build:
docker:
- image: circleci/python:3.6
steps:
- loadtest/loadtest:
nWorkers: 2
susTime: 30
targetHostUrl: https://www.example.com
version: 2.1
This mainstream example does a small loadtest using a workflow with a job based on the orb. To use this orb, you need to define a $NCS_AUTH_TOKEN environment variable.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
jobs:
build:
docker:
- image: circleci/node:10
steps:
- checkout
- run: echo your BUILD code here
version: 2.1
workflows:
build_and_test:
jobs:
- build
- loadtest/loadtest:
nWorkers: 2
requires:
- build
susTime: 30
targetHostUrl: https://www.example.com
version: 2
performs a loadtest using Necocortix Last-Mile Loadtest service (in a dedicated container)
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
altTargetHostUrl | an alternative target host URL for comparison | No | '""' | string |
branch | which branch to get get orb support code from | No | master | string |
executorImage | (advanced) use this only if you need to override the python executor | No | circleci/python:3.6 | string |
nWorkers | the # of worker instances to launch (or zero for all available) | No | 1 | integer |
ncs_auth_token | (advanced) the name of the env var to use for NCS_AUTH_TOKEN) | No | NCS_AUTH_TOKEN | env_var_name |
rampUpRate | # of simulated users to start per second (overall) (floating point number) | No | '0' | string |
regions | list of geographic regions (space-separated) (or empty for all regions) | No | '' | string |
reqMsprMean | Pass/Fail threshold for Mean Response Time (in milliseconds). The Mean Response Time is calculated in the last 30-second window of the test. If the Mean Response Time in the last 30-second window is less than the threshold, the test Passes; otherwise it fails. | No | 1000 | integer |
susTime | how much time to sustain the test after startup (in seconds) | No | 15 | integer |
targetHostUrl | url of the host to target as victim | Yes | - | string |
targetUris | list of URIs to target (space-separated) or empty for root | No | '' | string |
usersPerWorker | # of simulated users per worker | No | 6 | integer |
performs a loadtest using Necocortix Last-Mile Loadtest service (in the current container)
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
altTargetHostUrl | an alternative target host URL for comparison | No | '""' | string |
branch | which branch to get orb support code from | No | master | string |
nWorkers | the # of worker instances to launch (or zero for all available) | No | 1 | integer |
ncs_auth_token | (advanced) the name of the env var to use for NCS_AUTH_TOKEN) | No | NCS_AUTH_TOKEN | env_var_name |
rampUpRate | # of simulated users to start per second (overall) (floating point number) | No | '0' | string |
regions | list of geographic regions (space-separated) (or empty for all regions) | No | '' | string |
reqMsprMean | Pass/Fail threshold for Mean Response Time (in milliseconds). The Mean Response Time is calculated in the last 30-second window of the test. If the Mean Response Time in the last 30-second window is less than the threshold, the test Passes; otherwise it fails. | No | 1000 | integer |
susTime | how much time to sustain the test after startup (in seconds) | No | 15 | integer |
targetHostUrl | url of the host to target as victim | Yes | - | string |
targetUris | list of URIs to target (space-separated) or empty for root | No | '' | string |
usersPerWorker | # of simulated users per worker | No | 6 | integer |
uses a generic python 3 image, unless the caller overrides
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
image | (advanced) override the default to use a different docker image | No | circleci/python:3.6 | string |
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
# This code is licensed from CircleCI to the user under the MIT license.
# See here for details: https://circleci.com/developer/orbs/licensing
commands:
loadtest:
description: |
performs a loadtest using Necocortix Last-Mile Loadtest service (in the current container)
parameters:
altTargetHostUrl:
default: '""'
description: an alternative target host URL for comparison
type: string
branch:
default: master
description: which branch to get orb support code from
type: string
nWorkers:
default: 1
description: 'the # of worker instances to launch (or zero for all available)'
type: integer
ncs_auth_token:
default: NCS_AUTH_TOKEN
description: (advanced) the name of the env var to use for NCS_AUTH_TOKEN)
type: env_var_name
rampUpRate:
default: "0"
description: '# of simulated users to start per second (overall) (floating
point number)'
type: string
regions:
default: ""
description: list of geographic regions (space-separated) (or empty for all
regions)
type: string
reqMsprMean:
default: 1000
description: Pass/Fail threshold for Mean Response Time (in milliseconds). The
Mean Response Time is calculated in the last 30-second window of the test. If
the Mean Response Time in the last 30-second window is less than the threshold,
the test Passes; otherwise it fails.
type: integer
susTime:
default: 15
description: how much time to sustain the test after startup (in seconds)
type: integer
targetHostUrl:
description: url of the host to target as victim
type: string
targetUris:
default: ""
description: list of URIs to target (space-separated) or empty for root
type: string
usersPerWorker:
default: 6
description: '# of simulated users per worker'
type: integer
steps:
- run:
command: |
targetVersion="3.6"
errMsg="python $targetVersion is not available in this environment"
if ! hash python3; then
echo $errMsg
exit 1
fi
pyVersion="$(python3 -V 2>&1)"
echo $pyVersion
if [[ $pyVersion =~ $targetVersion ]]
then
echo found $pyVersion
exit 0
else
echo $errMsg
fi
exit 1
name: checking for required python version
- run:
command: wget https://raw.githubusercontent.com/neocortix/cci_loadtest/<<
parameters.branch >>/runRemoteLoadtest.py
name: fetching code (<< parameters.branch >>)
- run:
command: python3 ./runRemoteLoadtest.py << parameters.targetHostUrl >> --nWorkers
<< parameters.nWorkers >> --susTime << parameters.susTime >> --rampUpRate
<< parameters.rampUpRate >> --usersPerWorker << parameters.usersPerWorker
>> --reqMsprMean << parameters.reqMsprMean >> --altTargetHostUrl << parameters.altTargetHostUrl
>> --regions << parameters.regions >> --targetUris << parameters.targetUris
>> --jsonOut data/loadtest_out.json --masterUrl https://load-test.cloud.neocortix.com/
--authToken ${<< parameters.ncs_auth_token >>}
name: loadtesting
- store_artifacts:
path: data
- store_test_results:
path: data/test-results
description: |
Perform Neocortix Last-Mile Load Testing for your projects, using our global network of mobile devices.
Get an Auth Token by following these steps:
- Go to cloud.neocortix.com
- Sign up for a Neocortix Cloud Services account with your email address.
- You will be able to run one small, free Load Test in the Free Tier (with 2 devices, up to 10 minutes long) without providing any payment method. Or you can run two small free Load Tests with one device each.
- To continue with free Load Tests in the Free Tier (up to 10 devices, up to 10 minutes long), please provide a Payment Method at Account / Billing / Payment Methods, which will not be charged while you use your 100 free hours.
- To run Large Load Tests (up to 800 devices, any duration), please provide a Payment Method as above, and then go to Account / Billing and upgrade from Free Tier to Paid Tier.
- Go to Account / Profile. Click on Auth Tokens.
- Click on New Token. A new Auth Token will be generated for you. You can copy that Auth Token to the clipboard and use it as the value of $NCS_AUTH_TOKEN in the steps below.
display:
home_url: https://cloud.neocortix.com
source_url: https://github.com/neocortix/cci_loadtest
examples:
loadtest_only:
description: |
This simple python-oriented example does a small loadtest using a command based on the orb. To use this orb, you need to define a $NCS_AUTH_TOKEN environment variable.
usage:
jobs:
build:
docker:
- image: circleci/python:3.6
steps:
- loadtest/loadtest:
nWorkers: 2
susTime: 30
targetHostUrl: https://www.example.com
version: 2.1
loadtest_workflow:
description: |
This mainstream example does a small loadtest using a workflow with a job based on the orb. To use this orb, you need to define a $NCS_AUTH_TOKEN environment variable.
usage:
jobs:
build:
docker:
- image: circleci/node:10
steps:
- checkout
- run: echo your BUILD code here
version: 2.1
workflows:
build_and_test:
jobs:
- build
- loadtest/loadtest:
nWorkers: 2
requires:
- build
susTime: 30
targetHostUrl: https://www.example.com
version: 2
executors:
default:
description: |
uses a generic python 3 image, unless the caller overrides
docker:
- image: << parameters.image >>
parameters:
image:
default: circleci/python:3.6
description: (advanced) override the default to use a different docker image
type: string
jobs:
loadtest:
description: |
performs a loadtest using Necocortix Last-Mile Loadtest service (in a dedicated container)
executor:
image: << parameters.executorImage >>
name: default
parameters:
altTargetHostUrl:
default: '""'
description: an alternative target host URL for comparison
type: string
branch:
default: master
description: which branch to get get orb support code from
type: string
executorImage:
default: circleci/python:3.6
description: (advanced) use this only if you need to override the python executor
type: string
nWorkers:
default: 1
description: 'the # of worker instances to launch (or zero for all available)'
type: integer
ncs_auth_token:
default: NCS_AUTH_TOKEN
description: (advanced) the name of the env var to use for NCS_AUTH_TOKEN)
type: env_var_name
rampUpRate:
default: "0"
description: '# of simulated users to start per second (overall) (floating
point number)'
type: string
regions:
default: ""
description: list of geographic regions (space-separated) (or empty for all
regions)
type: string
reqMsprMean:
default: 1000
description: Pass/Fail threshold for Mean Response Time (in milliseconds). The
Mean Response Time is calculated in the last 30-second window of the test. If
the Mean Response Time in the last 30-second window is less than the threshold,
the test Passes; otherwise it fails.
type: integer
susTime:
default: 15
description: how much time to sustain the test after startup (in seconds)
type: integer
targetHostUrl:
description: url of the host to target as victim
type: string
targetUris:
default: ""
description: list of URIs to target (space-separated) or empty for root
type: string
usersPerWorker:
default: 6
description: '# of simulated users per worker'
type: integer
steps:
- checkout
- loadtest:
altTargetHostUrl: << parameters.altTargetHostUrl >>
branch: << parameters.branch >>
nWorkers: << parameters.nWorkers >>
ncs_auth_token: << parameters.ncs_auth_token >>
rampUpRate: << parameters.rampUpRate >>
regions: << parameters.regions >>
reqMsprMean: << parameters.reqMsprMean >>
susTime: << parameters.susTime >>
targetHostUrl: << parameters.targetHostUrl >>
targetUris: << parameters.targetUris >>
usersPerWorker: << parameters.usersPerWorker >>
version: 2.1