Skip to content

Commit 3851b09

Browse files
[CircleCI]-Changes for newman
1 parent ff3e00c commit 3851b09

14 files changed

+213
-79
lines changed

.circleci/config.yml

Lines changed: 74 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
1-
version: 2
1+
version: 2.1
2+
parameters:
3+
run_automatedtesting:
4+
default: false
5+
type: boolean
6+
run_basedeployment:
7+
default: true
8+
type: boolean
29
defaults: &defaults
310
docker:
411
- image: circleci/python:2.7.18-stretch-browsers
512
install_dependency: &install_dependency
613
name: Installation of build and deployment dependencies.
714
command: |
8-
sudo apt install jq
9-
sudo pip install awscli --upgrade
10-
sudo pip install docker-compose
15+
sudo apt install jq python3-pip
16+
sudo pip3 install awscli --upgrade
17+
# sudo pip install docker-compose
1118
install_deploysuite: &install_deploysuite
1219
name: Installation of install_deploysuite.
1320
command: |
@@ -39,6 +46,17 @@ builddeploy_steps: &builddeploy_steps
3946
./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-${APPNAME}-deployvar
4047
source buildenvvar
4148
./master_deploy.sh -d ECS -e $DEPLOY_ENV -t latest -s ${LOGICAL_ENV}-global-appvar,${LOGICAL_ENV}-${APPNAME}-appvar -i ${APPNAME}
49+
#testing code changes
50+
if [[ true ]]; then
51+
./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-qa-v1-appvar
52+
source buildenvvar
53+
curl --request POST \
54+
--url https://circleci.com/api/v2/project/github/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pipeline \
55+
--header "Circle-Token: ${QA_USER_TOKEN}" \
56+
--header 'content-type: application/json' \
57+
--data '{"branch":"'"$CIRCLE_BRANCH"'","parameters":{"run_automatedtesting":true , "run_basedeployment": false}}'
58+
fi
59+
4260
jobs:
4361
# Build & Deploy against development backend
4462
"build-dev":
@@ -57,17 +75,53 @@ jobs:
5775
APPNAME: "taas-apis"
5876
steps: *builddeploy_steps
5977

78+
"Run-Newman-Test":
79+
docker:
80+
- image: circleci/node:12
81+
environment:
82+
DEPLOY_ENV: "DEV"
83+
LOGICAL_ENV: "dev"
84+
APPNAME: "taas-api"
85+
- image: tray/dynamodb-local
86+
command: "-inMemory -port 7777"
87+
- image: elasticsearch:6.8.13
88+
environment:
89+
discovery.type: "single-node"
90+
steps:
91+
- checkout
92+
- setup_remote_docker
93+
- run: *install_dependency
94+
- run: *install_deploysuite
95+
- run:
96+
name: 'newman test'
97+
no_output_timeout: 30m
98+
command: |
99+
./awsconfiguration.sh $DEPLOY_ENV
100+
source awsenvconf
101+
./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-global-appvar,${LOGICAL_ENV}-${APPNAME}-qa-appvar
102+
source buildenvvar
103+
npm install --loglevel verbose
104+
cd mock
105+
(npm run mock-challenge-api&)
106+
(NODE_ENV=test npm start&)
107+
npm run test:newman:clear
108+
npm run test:newman
109+
npm run test:newman:clear
110+
- store_artifacts:
111+
path: ./newman
112+
60113
workflows:
61114
version: 2
62115
build:
116+
when: << pipeline.parameters.run_basedeployment >>
63117
jobs:
64118
# Development builds are executed on "develop" branch only.
65119
- "build-dev":
66120
context : org-global
67121
filters:
68122
branches:
69123
only:
70-
- dev
124+
- circleci
71125

72126
# Production builds are exectuted only on tagged commits to the
73127
# master branch.
@@ -76,3 +130,18 @@ workflows:
76130
filters:
77131
branches:
78132
only: master
133+
134+
testingflow:
135+
when: << pipeline.parameters.run_automatedtesting >>
136+
jobs:
137+
- Hold [Performance-Testing]:
138+
type: approval
139+
- "Run-Newman-Test":
140+
context : org-global
141+
requires:
142+
- Hold [Performance-Testing]
143+
filters:
144+
branches:
145+
only:
146+
- circleci
147+
- dev-circleci

app-constants.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ const FullManagePermissionRoles = [
1515
]
1616

1717
const Scopes = {
18+
// all resources
19+
ALL_RESOURCES: 'all:resources',
1820
// job
1921
READ_JOB: 'read:taas-jobs',
2022
CREATE_JOB: 'create:taas-jobs',

env.sh

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,26 @@ export AUTH_SECRET="UgL4(SEAM*~yc7L~vWrKKN&GHrwyc9N[@nVxm,X?#b4}7:xbzM"
33
export AUTH0_URL=https://topcoder-dev.auth0.com/oauth/token
44
export AUTH0_AUDIENCE=https://m2m.topcoder-dev.com/
55
export AUTH0_AUDIENCE_UBAHN=https://u-bahn.topcoder.com
6-
export AUTH0_CLIENT_ID=gZ6jt50HYHLBf4vhxjUhXPZOR7Q5lk4k
7-
export AUTH0_CLIENT_SECRET=zb-OV1Rl3QpUkt4BexJ-Rs58jYMazCre1_97aU4PJIvQdVB-DmQIs61W3gCfPyP4
6+
# export AUTH0_CLIENT_ID=gZ6jt50HYHLBf4vhxjUhXPZOR7Q5lk4k
7+
# export AUTH0_CLIENT_SECRET=zb-OV1Rl3QpUkt4BexJ-Rs58jYMazCre1_97aU4PJIvQdVB-DmQIs61W3gCfPyP4
8+
export AUTH0_CLIENT_ID=4eNsa6sy080ijgw9c0ZnkM0X918Wjn5r
9+
export AUTH0_CLIENT_SECRET=8sE_zRyPiwlGAa8m3V6vy9o6w6AN3YMdLZGs9ESV-kLRcmVwkRUZrOJ4x1o2nJ9Z
810
export BUSAPI_URL=http://localhost:8002/v5
911
export AUTH_V2_URL=https://topcoder-dev.auth0.com/oauth/ro
1012
export AUTH_V2_CLIENT_ID=JFDo7HMkf0q2CkVFHojy3zHWafziprhT
1113
export AUTH_V3_URL=https://api.topcoder-dev.com/v3/authorizations
12-
export ADMIN_CREDENTIALS_USERNAME=jcori
14+
export ADMIN_CREDENTIALS_USERNAME=mess
1315
export ADMIN_CREDENTIALS_PASSWORD=appirio123
14-
export MANAGER_CREDENTIALS_USERNAME=TonyJ
16+
export MANAGER_CREDENTIALS_USERNAME=mess
1517
export MANAGER_CREDENTIALS_PASSWORD=appirio123
1618
export COPILOT_CREDENTIALS_USERNAME=TCConnCopilot
17-
export COPILOT_CREDENTIALS_PASSWORD=appirio123
18-
export USER_CREDENTIALS_USERNAME=isbilir
19-
export USER_CREDENTIALS_PASSWORD=@Topcoder123
19+
export COPILOT_CREDENTIALS_PASSWORD=Appirio123
20+
export USER_CREDENTIALS_USERNAME=e2e20190909
21+
export USER_CREDENTIALS_PASSWORD=Password@123
2022
export ES_HOST=http://localhost:9200
2123
export DATABASE_URL=postgres://postgres:postgres@localhost:5432/postgres
2224
export MOCK_API_PORT=4000
23-
export API_BASE_URL=http://localhost:3000
24-
export TC_API=http://localhost:4000/v5
25+
export API_BASE_URL=https://api.topcoder-dev.com/v5
26+
export TC_API=https://api.topcoder-dev.com/v5
2527
export TOPCODER_USERS_API=http://localhost:4000/v3/users
2628
export TOPCODER_MEMBERS_API=http://localhost:4000/v3/members

src/routes/JobRoutes.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,39 +9,39 @@ module.exports = {
99
controller: 'JobController',
1010
method: 'createJob',
1111
auth: 'jwt',
12-
scopes: [constants.Scopes.CREATE_JOB, constants.Scopes.ALL_JOB]
12+
scopes: [constants.Scopes.CREATE_JOB, constants.Scopes.ALL_JOB, constants.Scopes.ALL_RESOURCES]
1313
},
1414
get: {
1515
controller: 'JobController',
1616
method: 'searchJobs',
1717
auth: 'jwt',
18-
scopes: [constants.Scopes.READ_JOB, constants.Scopes.ALL_JOB]
18+
scopes: [constants.Scopes.READ_JOB, constants.Scopes.ALL_JOB, constants.Scopes.ALL_RESOURCES]
1919
}
2020
},
2121
'/jobs/:id': {
2222
get: {
2323
controller: 'JobController',
2424
method: 'getJob',
2525
auth: 'jwt',
26-
scopes: [constants.Scopes.READ_JOB, constants.Scopes.ALL_JOB]
26+
scopes: [constants.Scopes.READ_JOB, constants.Scopes.ALL_JOB, constants.Scopes.ALL_RESOURCES]
2727
},
2828
put: {
2929
controller: 'JobController',
3030
method: 'fullyUpdateJob',
3131
auth: 'jwt',
32-
scopes: [constants.Scopes.UPDATE_JOB, constants.Scopes.ALL_JOB]
32+
scopes: [constants.Scopes.UPDATE_JOB, constants.Scopes.ALL_JOB, constants.Scopes.ALL_RESOURCES]
3333
},
3434
patch: {
3535
controller: 'JobController',
3636
method: 'partiallyUpdateJob',
3737
auth: 'jwt',
38-
scopes: [constants.Scopes.UPDATE_JOB, constants.Scopes.ALL_JOB]
38+
scopes: [constants.Scopes.UPDATE_JOB, constants.Scopes.ALL_JOB, constants.Scopes.ALL_RESOURCES]
3939
},
4040
delete: {
4141
controller: 'JobController',
4242
method: 'deleteJob',
4343
auth: 'jwt',
44-
scopes: [constants.Scopes.DELETE_JOB, constants.Scopes.ALL_JOB]
44+
scopes: [constants.Scopes.DELETE_JOB, constants.Scopes.ALL_JOB, constants.Scopes.ALL_RESOURCES]
4545
}
4646
}
4747
}

test/postman/newman.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -906,14 +906,14 @@ const taasTeamRequests = [
906906
]
907907

908908
const requests = [
909-
...healthCheckRequests,
909+
//...healthCheckRequests,
910910
...jobRequests,
911911
...jobCandidateRequests,
912-
...resourceBookingRequests,
913-
...workPeriodRequests,
914-
...workPeriodPaymentRequests,
915-
...interviewRequests,
916-
...taasTeamRequests
912+
// ...resourceBookingRequests,
913+
// ...workPeriodRequests,
914+
// ...workPeriodPaymentRequests,
915+
// ...interviewRequests,
916+
// ...taasTeamRequests
917917
]
918918

919919
/**

test/postman/testData/job/create-job-by-invalid-field.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"externalId": "1212",
88
"title": "POSTMANE2E-Dummy title",
99
"description": "Dummy Description",
10-
"startDate": "2020-09-27T04:17:23.131Z",
10+
"startDate": "2020-09-27",
1111
"duration": 1,
1212
"numPositions": 13,
1313
"resourceType": "Dummy Resource Type",
@@ -30,7 +30,7 @@
3030
"externalId": "1212",
3131
"title": "POSTMANE2E-Dummy title",
3232
"description": "Dummy Description",
33-
"startDate": "2020-09-27T04:17:23.131Z",
33+
"startDate": "2020-09-27",
3434
"duration": 1,
3535
"numPositions": 13,
3636
"resourceType": "Dummy Resource Type",
@@ -50,7 +50,7 @@
5050
"externalId": "1212",
5151
"title": "POSTMANE2E-Dummy title",
5252
"description": "Dummy Description",
53-
"startDate": "2020-09-27T04:17:23.131Z",
53+
"startDate": "2020-09-27",
5454
"duration": 1,
5555
"numPositions": 13,
5656
"resourceType": "Dummy Resource Type",
@@ -70,7 +70,7 @@
7070
"externalId": 1212,
7171
"title": "POSTMANE2E-Dummy title",
7272
"description": "Dummy Description",
73-
"startDate": "2020-09-27T04:17:23.131Z",
73+
"startDate": "2020-09-27",
7474
"duration": 1,
7575
"numPositions": 13,
7676
"resourceType": "Dummy Resource Type",
@@ -90,7 +90,7 @@
9090
"externalId": "1212",
9191
"title": 111,
9292
"description": "Dummy Description",
93-
"startDate": "2020-09-27T04:17:23.131Z",
93+
"startDate": "2020-09-27",
9494
"duration": 1,
9595
"numPositions": 13,
9696
"resourceType": "Dummy Resource Type",
@@ -110,7 +110,7 @@
110110
"externalId": "1212",
111111
"title": "POSTMANE2E-Dummy title",
112112
"description": 111,
113-
"startDate": "2020-09-27T04:17:23.131Z",
113+
"startDate": "2020-09-27",
114114
"duration": 1,
115115
"numPositions": 13,
116116
"resourceType": "Dummy Resource Type",
@@ -141,7 +141,7 @@
141141
]
142142
},
143143
"httpStatus": 400,
144-
"message": "\"job.startDate\" must be a valid date"
144+
"message": "\"job.startDate\" must be in YYYY-MM-DD format"
145145
},
146146
{
147147
"token": "m2m_token",
@@ -150,7 +150,7 @@
150150
"externalId": "1212",
151151
"title": "POSTMANE2E-Dummy title",
152152
"description": "Dummy Description",
153-
"startDate": "2020-09-27T04:17:23.131Z",
153+
"startDate": "2020-09-27",
154154
"duration": -1,
155155
"numPositions": 13,
156156
"resourceType": "Dummy Resource Type",
@@ -170,7 +170,7 @@
170170
"externalId": "1212",
171171
"title": "POSTMANE2E-Dummy title",
172172
"description": "Dummy Description",
173-
"startDate": "2020-09-27T04:17:23.131Z",
173+
"startDate": "2020-09-27",
174174
"duration": 1,
175175
"numPositions": -13,
176176
"resourceType": "Dummy Resource Type",
@@ -190,7 +190,7 @@
190190
"externalId": "1212",
191191
"title": "POSTMANE2E-Dummy title",
192192
"description": "Dummy Description",
193-
"startDate": "2020-09-27T04:17:23.131Z",
193+
"startDate": "2020-09-27",
194194
"duration": 1,
195195
"numPositions": 13,
196196
"resourceType": 111,
@@ -210,7 +210,7 @@
210210
"externalId": "1212",
211211
"title": "POSTMANE2E-Dummy title",
212212
"description": "Dummy Description",
213-
"startDate": "2020-09-27T04:17:23.131Z",
213+
"startDate": "2020-09-27",
214214
"duration": 1,
215215
"numPositions": 13,
216216
"resourceType": "Dummy Resource Type",
@@ -230,7 +230,7 @@
230230
"externalId": "1212",
231231
"title": "POSTMANE2E-Dummy title",
232232
"description": "Dummy Description",
233-
"startDate": "2020-09-27T04:17:23.131Z",
233+
"startDate": "2020-09-27",
234234
"duration": 1,
235235
"numPositions": 13,
236236
"resourceType": "Dummy Resource Type",
@@ -250,7 +250,7 @@
250250
"externalId": "1212",
251251
"title": "POSTMANE2E-Dummy title",
252252
"description": "Dummy Description",
253-
"startDate": "2020-09-27T04:17:23.131Z",
253+
"startDate": "2020-09-27",
254254
"duration": 1,
255255
"numPositions": 13,
256256
"resourceType": "Dummy Resource Type",
@@ -270,7 +270,7 @@
270270
"externalId": "1212",
271271
"title": "POSTMANE2E-Dummy title",
272272
"description": "Dummy Description",
273-
"startDate": "2020-09-27T04:17:23.131Z",
273+
"startDate": "2020-09-27",
274274
"duration": 1,
275275
"numPositions": 13,
276276
"resourceType": "Dummy Resource Type",

test/postman/testData/job/create-job-by-missing-field.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"externalId": "1212",
66
"title": "POSTMANE2E-Dummy title",
77
"description": "Dummy Description",
8-
"startDate": "2020-09-27T04:17:23.131Z",
8+
"startDate": "2020-09-27",
99
"duration": 1,
1010
"numPositions": 13,
1111
"resourceType": "Dummy Resource Type",
@@ -24,7 +24,7 @@
2424
"projectId": 111,
2525
"externalId": "1212",
2626
"description": "Dummy Description",
27-
"startDate": "2020-09-27T04:17:23.131Z",
27+
"startDate": "2020-09-27",
2828
"duration": 1,
2929
"numPositions": 13,
3030
"resourceType": "Dummy Resource Type",
@@ -44,7 +44,7 @@
4444
"externalId": "1212",
4545
"title": "POSTMANE2E-Dummy title",
4646
"description": "Dummy Description",
47-
"startDate": "2020-09-27T04:17:23.131Z",
47+
"startDate": "2020-09-27",
4848
"duration": 1,
4949
"resourceType": "Dummy Resource Type",
5050
"rateType": "hourly",
@@ -63,7 +63,7 @@
6363
"externalId": "1212",
6464
"title": "POSTMANE2E-Dummy title",
6565
"description": "Dummy Description",
66-
"startDate": "2020-09-27T04:17:23.131Z",
66+
"startDate": "2020-09-27",
6767
"duration": 1,
6868
"numPositions": 13,
6969
"resourceType": "Dummy Resource Type",

0 commit comments

Comments
 (0)