Просмотр исходного кода

set up acceptance tests to run via docker

James Allen 9 лет назад
Родитель
Сommit
f7ba554658

+ 7 - 0
services/docstore/Gruntfile.coffee

@@ -6,6 +6,7 @@ module.exports = (grunt) ->
 			app:
 				options:
 					index: "app.js"
+
 		coffee:
 			app_src:
 				expand: true,
@@ -67,6 +68,10 @@ module.exports = (grunt) ->
 					reporter: grunt.option('reporter') or 'spec'
 					timeout: 10000
 				src: ["test/smoke/js/**/*.js"]
+		
+		shell:
+			dockerTests:
+				command: 'docker run -v "$(pwd):/app" -e AWS_ACCESS_KEY_ID="$AWS_ACCESS_KEY_ID" -e AWS_SECRET_ACCESS_KEY="$AWS_SECRET_ACCESS_KEY" -e AWS_BUCKET="$AWS_BUCKET" --rm sl-acceptance-test-runner'
 
 	grunt.loadNpmTasks 'grunt-contrib-coffee'
 	grunt.loadNpmTasks 'grunt-contrib-clean'
@@ -89,6 +94,8 @@ module.exports = (grunt) ->
 	grunt.registerTask 'test:smoke',          ['compile:smoke_tests', 'mochaTest:smoke']
 
 	grunt.registerTask 'install', 'compile:app'
+	
+	grunt.registerTask 'test:acceptance:docker', ['compile:acceptance_tests', 'shell:dockerTests']
 
 	grunt.registerTask 'default', ['run']
 

+ 8 - 6
services/docstore/config/settings.defaults.coffee

@@ -1,7 +1,7 @@
 http = require('http')
 http.globalAgent.maxSockets = 300
 
-module.exports =
+module.exports = Settings =
 	internal:
 		docstore:
 			port: 3016
@@ -12,10 +12,12 @@ module.exports =
 
 	docstore:
 		healthCheck:
-			project_id: "5620bece05509b0a7a3cbc61"
-	#	s3:
-	#		key: ""
-	#		secret: ""
-	#		bucket: "something"
+			project_id: ""
 
 	max_doc_length: 2 * 1024 * 1024 # 2mb
+
+if process.env['AWS_ACCESS_KEY_ID']? and process.env['AWS_SECRET_ACCESS_KEY']? and process.env['AWS_BUCKET']?
+	Settings.docstore.s3 =
+		key: process.env['AWS_ACCESS_KEY_ID']
+		secret: process.env['AWS_SECRET_ACCESS_KEY']
+		bucket: process.env['AWS_BUCKET']

+ 23 - 0
services/docstore/test/acceptance/scripts/full-test.sh

@@ -0,0 +1,23 @@
+#! /usr/bin/env bash
+
+echo $AWS_BUCKET
+
+echo ">> Starting server..."
+
+grunt forever:app:start
+
+echo ">> Server started"
+
+sleep 5
+
+echo ">> Running acceptance tests..."
+grunt mochaTest:acceptance
+_test_exit_code=$?
+
+echo ">> Killing server"
+
+grunt forever:app:stop
+
+echo ">> Done"
+
+exit $_test_exit_code