Skip to content
This repository was archived by the owner on Jan 7, 2020. It is now read-only.

Commit 07adae7

Browse files
authored
Merge pull request #378 from NickPhura/EM-676
EM-676: Add functional test fixtures & automated local execution.
2 parents 71c1cd0 + 6a8fe2e commit 07adae7

File tree

16 files changed

+720
-151
lines changed

16 files changed

+720
-151
lines changed

Jenkinsfile.dev

Lines changed: 56 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def notifySlack(text, url, channel, attachments) {
1414
attachments: attachments
1515
])
1616
def encodedReq = URLEncoder.encode(payload, "UTF-8")
17-
sh("curl -s -S -X POST --data \'payload=${encodedReq}\' ${slackURL}")
17+
sh("curl -s -S -X POST --data \'payload=${encodedReq}\' ${slackURL}")
1818
}
1919

2020
/*
@@ -30,7 +30,7 @@ def buildsSinceLastSuccess(previousBuild, build) {
3030
}
3131

3232
/*
33-
* Generates a string containing all the commit messages from
33+
* Generates a string containing all the commit messages from
3434
* the builds in pastBuilds.
3535
*/
3636
@NonCPS
@@ -103,7 +103,7 @@ podTemplate(label: 'generic-maven', name: 'generic-maven', serviceAccount: 'jenk
103103
}
104104
}
105105
}
106-
}
106+
}
107107

108108
podTemplate(label: 'sonarqube-maven', name: 'sonarqube-maven', serviceAccount: 'jenkins', cloud: 'openshift', containers: [
109109
containerTemplate(
@@ -136,7 +136,7 @@ podTemplate(label: 'sonarqube-maven', name: 'sonarqube-maven', serviceAccount: '
136136
}
137137
}
138138
}
139-
}
139+
}
140140

141141
podTemplate(label: 'generic-maven', name: 'generic-maven', serviceAccount: 'jenkins', cloud: 'openshift', containers: [
142142
containerTemplate(
@@ -184,57 +184,58 @@ podTemplate(label: 'generic-maven', name: 'generic-maven', serviceAccount: 'jenk
184184
}
185185
}
186186

187-
podTemplate(label: 'bddstack', name: 'bddstack', serviceAccount: 'jenkins', cloud: 'openshift', containers: [
188-
containerTemplate(
189-
name: 'jnlp',
190-
image: '172.50.0.2:5000/openshift/jenkins-slave-bddstack',
191-
resourceRequestCpu: '500m',
192-
resourceLimitCpu: '1000m',
193-
resourceRequestMemory: '1Gi',
194-
resourceLimitMemory: '4Gi',
195-
workingDir: '/home/jenkins',
196-
command: '',
197-
args: '${computer.jnlpmac} ${computer.name}',
198-
envVars: [
199-
secretEnvVar(key: 'ADMINPW', secretName: 'esm-server-secrets', secretKey: 'dev-admin-pwd')
200-
]
201-
)
202-
])
203-
{
204-
stage('FT on Dev') {
205-
node('bddstack') {
206-
//the checkout is mandatory, otherwise functional test would fail
207-
echo "checking out source"
208-
echo "Build: ${BUILD_ID}"
209-
checkout scm
210-
dir('functional-tests') {
211-
try {
212-
sh './gradlew chromeHeadlessTest'
213-
} finally {
214-
archiveArtifacts allowEmptyArchive: true, artifacts: 'build/reports/geb/**/*'
215-
junit 'build/test-results/**/*.xml'
216-
publishHTML (target: [
217-
allowMissing: false,
218-
alwaysLinkToLastBuild: false,
219-
keepAll: true,
220-
reportDir: 'build/reports/spock',
221-
reportFiles: 'index.html',
222-
reportName: "BDD Spock Report"
223-
])
224-
publishHTML (target: [
225-
allowMissing: false,
226-
alwaysLinkToLastBuild: false,
227-
keepAll: true,
228-
reportDir: 'build/reports/tests/chromeHeadlessTest',
229-
reportFiles: 'index.html',
230-
reportName: "Full Test Report"
231-
])
232-
perfReport compareBuildPrevious: true, excludeResponseTime: true, ignoreFailedBuilds: true, ignoreUnstableBuilds: true, modeEvaluation: true, modePerformancePerTestCase: true, percentiles: '0,50,90,100', relativeFailedThresholdNegative: 80.0, relativeFailedThresholdPositive: 20.0, relativeUnstableThresholdNegative: 50.0, relativeUnstableThresholdPositive: 50.0, sourceDataFiles: 'build/test-results/**/*.xml'
233-
}
234-
}
235-
}
236-
}
237-
}
187+
// TODO: activate and verify once the new bddstack jenkins slave image is available
188+
// podTemplate(label: 'bddstack', name: 'bddstack', serviceAccount: 'jenkins', cloud: 'openshift', containers: [
189+
// containerTemplate(
190+
// name: 'jnlp',
191+
// image: '172.50.0.2:5000/openshift/jenkins-slave-bddstack',
192+
// resourceRequestCpu: '500m',
193+
// resourceLimitCpu: '1000m',
194+
// resourceRequestMemory: '1Gi',
195+
// resourceLimitMemory: '4Gi',
196+
// workingDir: '/home/jenkins',
197+
// command: '',
198+
// args: '${computer.jnlpmac} ${computer.name}',
199+
// envVars: [
200+
// secretEnvVar(key: 'ADMINPW', secretName: 'esm-server-secrets', secretKey: 'dev-admin-pwd')
201+
// ]
202+
// )
203+
// ])
204+
// {
205+
// stage('FT on Dev') {
206+
// node('bddstack') {
207+
// //the checkout is mandatory, otherwise functional test would fail
208+
// echo "checking out source"
209+
// echo "Build: ${BUILD_ID}"
210+
// checkout scm
211+
// dir('functional-tests') {
212+
// try {
213+
// sh './gradlew chromeHeadlessTest'
214+
// } finally {
215+
// archiveArtifacts allowEmptyArchive: true, artifacts: 'build/reports/geb/**/*'
216+
// junit 'build/test-results/**/*.xml'
217+
// publishHTML (target: [
218+
// allowMissing: false,
219+
// alwaysLinkToLastBuild: false,
220+
// keepAll: true,
221+
// reportDir: 'build/reports/spock',
222+
// reportFiles: 'index.html',
223+
// reportName: "BDD Spock Report"
224+
// ])
225+
// publishHTML (target: [
226+
// allowMissing: false,
227+
// alwaysLinkToLastBuild: false,
228+
// keepAll: true,
229+
// reportDir: 'build/reports/tests/chromeHeadlessTest',
230+
// reportFiles: 'index.html',
231+
// reportName: "Full Test Report"
232+
// ])
233+
// perfReport compareBuildPrevious: true, excludeResponseTime: true, ignoreFailedBuilds: true, ignoreUnstableBuilds: true, modeEvaluation: true, modePerformancePerTestCase: true, percentiles: '0,50,90,100', relativeFailedThresholdNegative: 80.0, relativeFailedThresholdPositive: 20.0, relativeUnstableThresholdNegative: 50.0, relativeUnstableThresholdPositive: 50.0, sourceDataFiles: 'build/test-results/**/*.xml'
234+
// }
235+
// }
236+
// }
237+
// }
238+
// }
238239

239240
podTemplate(label: 'owasp-zap', name: 'owasp-zap', serviceAccount: 'jenkins', cloud: 'openshift', containers: [
240241
containerTemplate(

config/assets/functional.js

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
'use strict';
2+
3+
module.exports = {
4+
client: {
5+
lib: {
6+
css: [
7+
'public/lib/bootstrap/dist/css/bootstrap.css',
8+
'public/lib/angular-toastr/dist/angular-toastr.css',
9+
'public/lib/angular-bootstrap/ui-bootstrap-csp.css',
10+
'public/assimilated/ng-table/dist/ng-table.min.css'
11+
],
12+
js: [
13+
'public/lib/es6-shim/es6-shim.min.js',
14+
'public/lib/angular/angular.js',
15+
'public/lib/angular-resource/angular-resource.js',
16+
'public/lib/angular-animate/angular-animate.js',
17+
'public/lib/angular-messages/angular-messages.js',
18+
'public/lib/angular-ui-router/release/angular-ui-router.js',
19+
'public/lib/angular-ui-utils/ui-utils.js',
20+
'public/lib/tinymce/tinymce.js',
21+
'public/lib/angular-ui-tinymce/src/tinymce.js',
22+
'public/lib/jquery/dist/jquery.min.js',
23+
'public/lib/bootstrap/dist/js/bootstrap.min.js',
24+
'public/lib/angular-bootstrap/ui-bootstrap.js',
25+
'public/lib/angular-bootstrap/ui-bootstrap-tpls.js',
26+
'public/lib/angular-file-upload/angular-file-upload.js',
27+
'public/lib/ng-file-upload/ng-file-upload.js',
28+
'public/lib/angular-sanitize/angular-sanitize.js',
29+
'public/lib/angular-toastr/dist/angular-toastr.js',
30+
'public/lib/angular-toastr/dist/angular-toastr.tpls.js',
31+
'public/lib/angular-bootstrap-confirm/dist/angular-bootstrap-confirm.min.js',
32+
'public/lib/lodash/lodash.min.js',
33+
'public/lib/angular-simple-logger/dist/angular-simple-logger.js',
34+
'public/lib/angular-google-maps/dist/angular-google-maps.min.js',
35+
'public/lib/d3/d3.min.js',
36+
'public/lib/angularD3/dist/angularD3.js',
37+
'public/assimilated/ng-table/dist/ng-table.js',
38+
'public/lib/moment/moment.js',
39+
'public/lib/moment-timezone/moment-timezone.js',
40+
'public/lib/angular-moment/angular-moment.js',
41+
'public/lib/angular-scroll/angular-scroll.min.js',
42+
'public/lib/angular-cookies/angular-cookies.min.js',
43+
'public/moment-timezone-data.js',
44+
'public/readable-range.js',
45+
'public/lib/pdfjs-dist/build/pdf.combined.js',
46+
'public/lib/ng-pdfviewer/ng-pdfviewer.js',
47+
'public/lib/ng-pdfviewer/pdf.js',
48+
'public/lib/ng-pdfviewer/compatibility.js'
49+
],
50+
tests: ['public/lib/angular-mocks/angular-mocks.js']
51+
},
52+
css: ['modules/*/client/css/*.css'],
53+
less: ['modules/*/client/less/*.less'],
54+
sass: ['modules/*/client/scss/*.scss'],
55+
js: [
56+
'modules/core/client/app/config.js',
57+
'modules/core/client/app/init.js',
58+
'modules/*/client/*.js',
59+
'modules/*/client/**/*.js',
60+
'modules/*/processes/*/client/*.js',
61+
'modules/*/processes/*/client/**/*.js',
62+
'modules/*/controls/*/client/*.js',
63+
'modules/*/controls/*/client/**/*.js'
64+
],
65+
views: [
66+
'modules/*/client/views/**/*.html',
67+
'modules/*/processes/*/client/views/**/*.html',
68+
'modules/*/controls/*/client/views/**/*.html'
69+
],
70+
templates: ['build/templates.js']
71+
},
72+
server: {
73+
gruntConfig: 'gruntfile.js',
74+
allJS: ['server.js', 'config/**/*.js', 'modules/*/server/**/*.js'],
75+
models: [
76+
'modules/*/server/models/**/*.js',
77+
'modules/*/processes/*/server/models/**/*.js'
78+
],
79+
routes: [
80+
'modules/!(core)/server/routes/**/*.js',
81+
'modules/core/server/routes/**/*.js'
82+
],
83+
sockets: 'modules/*/server/sockets/**/*.js',
84+
config: 'modules/*/server/config/*.js',
85+
policies: 'modules/*/server/policies/*.js',
86+
views: 'modules/*/server/views/*.html'
87+
}
88+
};

config/env/default.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,20 @@ module.exports = {
88
googleAnalyticsTrackingID: process.env.GOOGLE_ANALYTICS_TRACKING_ID || 'GOOGLE_ANALYTICS_TRACKING_ID'
99
},
1010
port: process.env.PORT || 3000,
11+
token: {
12+
tokenQuery: process.env.TOKEN_QUERY || 'smgov_userguid',
13+
tokenParams: process.env.TOKEN_PARAMS || undefined,
14+
tokenField: process.env.TOKEN_FIELD || undefined,
15+
tokenHeader: process.env.TOKEN_HEADER || 'smgov_userguid',
16+
failedOnMissing: process.env.TOKEN_ON_MISSING || false
17+
},
1118
templateEngine: 'swig',
1219
// Session Cookie settings
1320
sessionCookie: {
1421
// session expiration is set by default to 24 hours
1522
maxAge: 24 * (60 * 60 * 1000),
1623
// httpOnly flag makes sure the cookie is only accessed
17-
// through the HTTP protocol and not JS/browser
24+
// through the HTTP protocol and not JS/browser
1825
httpOnly: true,
1926
// secure cookie should be turned to true to provide additional
2027
// layer of security so that the cookie is set only when working
@@ -30,6 +37,3 @@ module.exports = {
3037
logo: 'modules/core/client/img/brand/eao-banner-img-lg.png',
3138
favicon: 'modules/core/client/img/brand/favicon.ico'
3239
};
33-
34-
console.log(module.exports.app);
35-

config/env/development.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,5 @@ module.exports = {
7272
livereload: true,
7373
seedDB: process.env.MONGO_SEED || true
7474
};
75+
76+
console.log(module.exports.app);

config/env/functional.js

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
'use strict';
2+
3+
var defaultEnvConfig = require('./default');
4+
5+
module.exports = {
6+
db: {
7+
uri: process.env.MONGOHQ_URL || process.env.MONGOLAB_URI || 'mongodb://' + (process.env.DB_1_PORT_27017_TCP_ADDR || 'localhost') + '/' + (process.env.MONGODB_FUNC_DATABASE || 'esm-dev-func'),
8+
acluri: process.env.MONGOHQ_URL || process.env.MONGOLAB_URI || 'mongodb://' + (process.env.DB_1_PORT_27017_TCP_ADDR || 'localhost') + '/esm-acl-test',
9+
name: process.env.MONGODB_FUNC_DATABASE || 'esm-dev-func',
10+
options: {
11+
user: '',
12+
pass: ''
13+
},
14+
// Enable mongoose debug mode
15+
debug: process.env.MONGODB_DEBUG || false
16+
},
17+
port: process.env.FUNCTIONAL_PORT || 3001,
18+
app: {
19+
title: defaultEnvConfig.app.title + ' - Functional Test Environment'
20+
},
21+
facebook: {
22+
clientID: process.env.FACEBOOK_ID || 'APP_ID',
23+
clientSecret: process.env.FACEBOOK_SECRET || 'APP_SECRET',
24+
callbackURL: '/api/auth/facebook/callback'
25+
},
26+
twitter: {
27+
clientID: process.env.TWITTER_KEY || 'CONSUMER_KEY',
28+
clientSecret: process.env.TWITTER_SECRET || 'CONSUMER_SECRET',
29+
callbackURL: '/api/auth/twitter/callback'
30+
},
31+
google: {
32+
clientID: process.env.GOOGLE_ID || 'APP_ID',
33+
clientSecret: process.env.GOOGLE_SECRET || 'APP_SECRET',
34+
callbackURL: '/api/auth/google/callback'
35+
},
36+
linkedin: {
37+
clientID: process.env.LINKEDIN_ID || 'APP_ID',
38+
clientSecret: process.env.LINKEDIN_SECRET || 'APP_SECRET',
39+
callbackURL: '/api/auth/linkedin/callback'
40+
},
41+
github: {
42+
clientID: process.env.GITHUB_ID || 'APP_ID',
43+
clientSecret: process.env.GITHUB_SECRET || 'APP_SECRET',
44+
callbackURL: '/api/auth/github/callback'
45+
},
46+
paypal: {
47+
clientID: process.env.PAYPAL_ID || 'CLIENT_ID',
48+
clientSecret: process.env.PAYPAL_SECRET || 'CLIENT_SECRET',
49+
callbackURL: '/api/auth/paypal/callback',
50+
sandbox: true
51+
},
52+
mailer: {
53+
from: process.env.MAILER_FROM || 'MAILER_FROM',
54+
options: {
55+
service: process.env.MAILER_SERVICE_PROVIDER || 'MAILER_SERVICE_PROVIDER',
56+
auth: {
57+
user: process.env.MAILER_EMAIL_ID || 'MAILER_EMAIL_ID',
58+
pass: process.env.MAILER_PASSWORD || 'MAILER_PASSWORD'
59+
}
60+
}
61+
},
62+
63+
seedDB: process.env.MONGO_SEED || true
64+
65+
};
66+
67+
console.log(module.exports.app);

config/env/test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,5 @@ module.exports = {
6060
},
6161
seedDB: process.env.MONGO_SEED || true
6262
};
63+
64+
console.log(module.exports.app);

0 commit comments

Comments
 (0)