Skip to content

Commit 30b38d2

Browse files
committed
Randomly generated ngrok subdomain for integration tests (closes snowplow#333)
1 parent b5c5b74 commit 30b38d2

4 files changed

Lines changed: 19 additions & 3 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ node_modules
2020

2121
**/lodash.js
2222
tests/pages/*.js
23+
tests/pages/integration.html
2324
tags/tag.min.js
2425

2526
# creds for Grunt

.travis.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ install:
99
- unzip ./ngrok.zip\?os=linux\&arch=386\&channel=stable
1010
before_script:
1111
- node tests/integration/request_recorder.js &
12-
- ./ngrok -authtoken $NGROK_AUTH -subdomain=snowplow -log=stdout 8500 > /dev/null &
12+
13+
# Create a random ngrok subdomain
14+
- export SUBDOMAIN=$RANDOM$RANDOM
15+
- ./ngrok -authtoken $NGROK_AUTH -subdomain $SUBDOMAIN -log=stdout 8500 > /dev/null &
1316
script:
1417
- grunt travis
1518
after_script:

Gruntfile.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ module.exports = function(grunt) {
7777

7878
pkg: pkg,
7979

80+
subdomain: process.env.SUBDOMAIN,
81+
8082
lodash: {
8183
build: {
8284
dest: 'src/js/lib_managed/lodash.js',
@@ -119,6 +121,13 @@ module.exports = function(grunt) {
119121
},
120122
src: ['tags/tag.min.js'],
121123
dest: 'tags/tag.min.js'
124+
},
125+
test: {
126+
options: {
127+
'process': true
128+
},
129+
src: ['tests/pages/integration-template.html'],
130+
dest: 'tests/pages/integration.html'
122131
}
123132
},
124133

@@ -250,6 +259,6 @@ module.exports = function(grunt) {
250259
grunt.registerTask('publish', 'Upload to S3 and invalidate Cloudfront (full semantic version only)', ['upload_setup', 'lodash', 'browserify:main', 'concat:deploy', 'min:deploy', 's3:not_pinned', 'cloudfront:not_pinned']);
251260
grunt.registerTask('publish-pinned', 'Upload to S3 and invalidate Cloudfront (full semantic version and semantic major version)', ['upload_setup', 'lodash', 'browserify:main', 'concat:deploy', 'min:deploy', 's3', 'cloudfront']);
252261
grunt.registerTask('test', 'Intern tests', ['browserify:test', 'intern']);
253-
grunt.registerTask('travis', 'Intern tests for Travis CI', ['lodash','browserify:test','intern']);
262+
grunt.registerTask('travis', 'Intern tests for Travis CI', ['lodash','concat:test', 'browserify:test','intern']);
254263
grunt.registerTask('tags', 'Minifiy the Snowplow invocation tag', ['min:tag', 'concat:tag']);
255264
}
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818
};p[i].q=p[i].q||[];n=l.createElement(o);g=l.getElementsByTagName(o)[0];n.async=1;
1919
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","./snowplow.js","snowplow"));
2020

21-
window.snowplow('newTracker', 'cf', 'snowplow.ngrok.com', {
21+
// Taken from a random environment variable
22+
var subdomain = '<%= subdomain %>';
23+
24+
window.snowplow('newTracker', 'cf', subdomain + '.ngrok.com', {
2225
encodeBase64: true,
2326
appId: 'CFe23a',
2427
platform: 'mob'

0 commit comments

Comments
 (0)