Skip to content

Commit 7e5cc9d

Browse files
committed
Merge branch 'hotfix/cci-perf-testing'
2 parents 9f15ab2 + 76b6e95 commit 7e5cc9d

File tree

7 files changed

+1039
-0
lines changed

7 files changed

+1039
-0
lines changed

JMeter_README.md

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
# Performance Testing for Topcoder Connect App
2+
3+
## Description
4+
5+
Topcoder Connect is a web application that makes it easy to tap into the power of crowdsourcing to get more work done faster. Connect is ideal for projects that include application design and/or development work. You can crowdsource the entire application development lifecycle or just the specific stages where you need help. Common deliverables include application wireframes, UI/UX designs, prototypes, MVPs, and production-ready apps for any kind of device—mobile, wearables, or the web.
6+
7+
## Dependencies
8+
9+
- Jmeter maven plugin 2.9.0
10+
- Maven 3.5.2
11+
- JDK between 8 and 11
12+
13+
## Prerequisite
14+
15+
- We have already included the workflow into the circleci conf file with the usual dev builds.
16+
17+
## Directory Structure
18+
19+
- .circleci (Circleci configuration file)
20+
- \src\test\jmeter - Includes the JMX file(s) and CSV data files
21+
- pom file
22+
23+
### **Setup and Runtime**
24+
25+
Add the plugin to your project: Add the plugin to the build section of your pom's project
26+
27+
```
28+
<plugin>
29+
<groupId>com.lazerycode.jmeter</groupId>
30+
<artifactId>jmeter-maven-plugin</artifactId>
31+
<version>3.2.0</version>
32+
<executions>
33+
<!-- Generate JMeter configuration -->
34+
<execution>
35+
<id>configuration</id>
36+
<goals>
37+
<goal>configure</goal>
38+
</goals>
39+
</execution>
40+
<!-- Run JMeter tests -->
41+
<execution>
42+
<id>jmeter-tests</id>
43+
<goals>
44+
<goal>jmeter</goal>
45+
</goals>
46+
</execution>
47+
<!-- Fail build on errors in test -->
48+
<execution>
49+
<id>jmeter-check-results</id>
50+
<goals>
51+
<goal>results</goal>
52+
</goals>
53+
</execution>
54+
</executions>
55+
</plugin>
56+
```
57+
58+
This simple load test is already integrated with the current build process
59+
60+
```
61+
workflows:
62+
version: 2
63+
Connect Project Services:
64+
jobs:
65+
- build:
66+
context : org-global
67+
- deployDev:
68+
context : org-global
69+
requires:
70+
- build
71+
filters:
72+
branches:
73+
only: ['develop']
74+
- deployProd:
75+
context : org-global
76+
requires:
77+
- build
78+
filters:
79+
branches:
80+
only: ['master']
81+
- Hold [Performance-Testing]:
82+
type: approval
83+
requires:
84+
- build
85+
- deployDev
86+
- deployProd
87+
- Connect-Performance-Testing:
88+
requires:
89+
- Hold [Performance-Testing]
90+
```
91+
92+
- Hold [Performance-Testing] - This is the approval job we needs manual interaction.
93+
- It requires `build`, `deployDev` and `deployProd` jobs to run first.
94+
- Actual performance testing job is `Connect-Performance-Testing` and it requires `Hold [Performance-Testing]` job to finish.
95+
96+
### **Configuration**
97+
98+
<img src="https://imgur.com/0WNB89y.png" alt="">
99+
<img src="https://imgur.com/rdP3t77.png" alt="">
100+
101+
This performance test is for 15 virtual users. The parameters for this test plan is as below;
102+
103+
- Start Thread Count
104+
- Initial Deplay, sec (Startup Time + Hold Load For)
105+
- Startup Time, sec (Start Thread Count = Startup Time)
106+
- Hold Load For, sec
107+
- Shutdown Time (Next row `Initial Deplay`)
108+
109+
**Formulas:**
110+
111+
```
112+
Initial time of a record = initialtime + start up time/ramp-up time + holdtime of the previous record
113+
```
114+
115+
```
116+
start up time/ramp-up time = Shutdown time/ramp-down time of the previous record
117+
```
118+
119+
This setup is configured to run 6min with 15 UVs.
120+
121+
**Token Details**
122+
123+
- `audience` - https://m2m.topcoder-dev.com/
124+
- `grant_type` - client_credentials
125+
- `content-type` - application/json
126+
- `client_id` - jGIf2pd3f44B1jqvOai30BIKTZanYBfU
127+
- `client_secret` - ldzqVaVEbqhwjM5KtZ79sG8djZpAVK8Z7qieVcC3vRjI4NirgcinKSBpPwk6mYYP
128+
129+
To extract the token we are using the variable `access_token`
130+
131+
TO pass the `access_token` varaible globally we are using the beanshell Assertion
132+
133+
`${__setProperty(access_token, ${access_token})};`
134+
135+
**Random Controller**
136+
137+
We are using Random Controller to randomize the requests sent to the server to simulate the different request.
138+
139+
**Think Time**
140+
141+
We are using this parameter to implement a random wait time in betweent the request to simulate the real user experience.
142+
143+
**HTTP Requets**
144+
145+
- Access Tabs - Simulate user accessing different tabs
146+
- Access Projects - Simulate user accessing different projetcs
147+
- Assets Library (Link Insert) - Add Links to the projects
148+
149+
## Check the reports and data
150+
151+
After running the job using the circleci user can view the report by clicking on the Job: `Connect-Performance-Testing` > Artifacts > `target/jmeter/reports/15UV Ultimate Thread-Group/index.html`
152+
153+
eg: https://2728-60865675-gh.circle-artifacts.com/0/target/jmeter/reports/15UV%20Ultimate%20Thread-Group/index.html

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,10 @@ eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb2xlcyI6WyJhZG1pbmlzdHJhdG9yIl0sImlzcyI
357357
```
358358
It's been signed with the secret 'secret'. This secret should match your entry in config/local.js. You can generate your own token using https://jwt.io
359359

360+
## Performance Testing
361+
362+
- [Performance Testing Readme](README.md)
363+
360364
## Documentation
361365

362366
- [Projects Service Architecture](./docs/guides/architercture/architecture.md)

config.yml

Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
version: 2
2+
python_env: &python_env
3+
docker:
4+
- image: circleci/python:2.7-stretch-browsers
5+
6+
install_awscli: &install_awscli
7+
name: "Install awscli"
8+
command: |
9+
sudo pip install awscli --upgrade
10+
install_deploysuite: &install_deploysuite
11+
name: Installation of install_deploysuite.
12+
command: |
13+
git clone --branch v1.4.1 https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript
14+
cp ./../buildscript/master_deploy.sh .
15+
cp ./../buildscript/buildenv.sh .
16+
cp ./../buildscript/awsconfiguration.sh .
17+
18+
# Instructions of deployment
19+
deploy_steps: &deploy_steps
20+
- checkout
21+
- attach_workspace:
22+
at: ./workspace
23+
- run: *install_awscli
24+
- run: *install_deploysuite
25+
- setup_remote_docker
26+
- run: docker build -t ${APPNAME}:latest .
27+
- deploy:
28+
name: "Running Masterscript - deploy tc-project-service "
29+
command: |
30+
./awsconfiguration.sh $DEPLOY_ENV
31+
source awsenvconf
32+
./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-${APPNAME}-deployvar
33+
source buildenvvar
34+
./master_deploy.sh -d ECS -e $DEPLOY_ENV -t latest -s ${LOGICAL_ENV}-global-appvar,${LOGICAL_ENV}-${APPNAME}-appvar -i ${APPNAME}
35+
36+
echo "======= Running Masterscript - deploy projects-api-consumers ==========="
37+
if [ -e ${LOGICAL_ENV}-${APPNAME}-appvar.json ]; then sudo rm -vf ${LOGICAL_ENV}-${APPNAME}-appvar.json; fi
38+
./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-${APPNAME}-consumers-deployvar
39+
source buildenvvar
40+
./master_deploy.sh -d ECS -e $DEPLOY_ENV -t latest -s ${LOGICAL_ENV}-global-appvar,${LOGICAL_ENV}-${APPNAME}-appvar -i ${APPNAME}
41+
42+
jobs:
43+
UnitTests:
44+
docker:
45+
- image: circleci/node:12.16.1
46+
- image: circleci/postgres:9.6.2-alpine
47+
environment:
48+
- POSTGRES_USER: circle_test
49+
- POSTGRES_DB: circle_test
50+
- image: elasticsearch:2.3
51+
environment:
52+
DEPLOY_ENV: "DEV"
53+
LOGICAL_ENV: "dev"
54+
APPNAME: "projects-api"
55+
steps:
56+
- checkout
57+
- run:
58+
name: "Install dependeency"
59+
command: |
60+
sudo apt update
61+
sudo apt install curl
62+
sudo apt install python-pip
63+
- run: *install_awscli
64+
- run: *install_deploysuite
65+
- setup_remote_docker
66+
- restore_cache:
67+
key: test-node-modules-{{ checksum "package.json" }}
68+
- run: npm install
69+
- save_cache:
70+
key: test-node-modules-{{ checksum "package.json" }}
71+
paths:
72+
- node_modules
73+
- run: npm run lint
74+
- run:
75+
name: "Running Masterscript - deploy tc-project-service "
76+
command: |
77+
./awsconfiguration.sh $DEPLOY_ENV
78+
source awsenvconf
79+
./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-${APPNAME}-testvar
80+
source buildenvvar
81+
npm run test
82+
rm -f buildenvvar
83+
- run: npm run build
84+
- persist_to_workspace:
85+
root: .
86+
paths:
87+
- dist
88+
89+
deployProd:
90+
<<: *python_env
91+
environment:
92+
DEPLOY_ENV: "PROD"
93+
LOGICAL_ENV: "prod"
94+
APPNAME: "projects-api"
95+
steps: *deploy_steps
96+
97+
deployDev:
98+
<<: *python_env
99+
environment:
100+
DEPLOY_ENV: "DEV"
101+
LOGICAL_ENV: "dev"
102+
APPNAME: "projects-api"
103+
steps: *deploy_steps
104+
105+
Connect-Performance-Testing:
106+
docker:
107+
# specify the version you desire here
108+
- image: circleci/openjdk:8-jdk
109+
110+
# Specify service dependencies here if necessary
111+
# CircleCI maintains a library of pre-built images
112+
# documented at https://circleci.com/docs/2.0/circleci-images/
113+
# - image: circleci/postgres:9.4
114+
115+
working_directory: ~/repo
116+
117+
environment:
118+
# Customize the JVM maximum heap limit
119+
MAVEN_OPTS: -Xmx3200m
120+
121+
steps:
122+
- checkout
123+
124+
# Download and cache dependencies
125+
- restore_cache:
126+
keys:
127+
- v1-dependencies-{{ checksum "pom.xml" }}
128+
# fallback to using the latest cache if no exact match is found
129+
- v1-dependencies-
130+
131+
- run: mvn dependency:go-offline
132+
133+
- save_cache:
134+
paths:
135+
- ~/.m2
136+
key: v1-dependencies-{{ checksum "pom.xml" }}
137+
138+
- run: mvn verify
139+
140+
- store_artifacts:
141+
path: target/jmeter/reports
142+
143+
workflows:
144+
version: 2
145+
Connect Project Services:
146+
jobs:
147+
- UnitTests:
148+
context : org-global
149+
- deployDev:
150+
context : org-global
151+
requires:
152+
- UnitTests
153+
filters:
154+
branches:
155+
only: ['develop', 'connect-performance-testing']
156+
- deployProd:
157+
context : org-global
158+
requires:
159+
- UnitTests
160+
filters:
161+
branches:
162+
only: ['master']
163+
- Hold [Performance-Testing]:
164+
type: approval
165+
requires:
166+
- deployDev
167+
- deployProd
168+
- Connect-Performance-Testing:
169+
requires:
170+
- Hold [Performance-Testing]

0 commit comments

Comments
 (0)