# HG changeset patch # User ymh # Date 1394639578 -3600 # Node ID 6cbcec19079b73f98187f2118aabc13c9a15c4d1 # Parent f36260133ed9433358fd96f97973533eac424ea5 add automated script for test diff -r f36260133ed9 -r 6cbcec19079b .hgignore --- a/.hgignore Fri Mar 07 18:44:18 2014 +0100 +++ b/.hgignore Wed Mar 12 16:52:58 2014 +0100 @@ -18,4 +18,4 @@ dev/.vagrant dev/custom.yaml src/cm/scripts/test-suite/node_modules -src/cm/scripts/test-suite//workspace.info.js +src/cm/scripts/test-suite/workspace.info*.js diff -r f36260133ed9 -r 6cbcec19079b .hgsubstate --- a/.hgsubstate Fri Mar 07 18:44:18 2014 +0100 +++ b/.hgsubstate Wed Mar 12 16:52:58 2014 +0100 @@ -1,6 +1,6 @@ -6f10890dadd5743c0648e7d8224f412cc4d282a6 dev/modules/apt +6691c2faded01d273672b4db36f5a8651d3a934f dev/modules/apt cd2e1d97e94da67c184a3a121b4493898fabe4a8 dev/modules/concat -fb560784e8bbaddb696c60db243d40efb7c5271e dev/modules/nginx +5c36913dcda630f5244e0ecc885e3b436973d45a dev/modules/nginx 400a82d7e0f7374b61962364cb95315d0b5ee0d0 dev/modules/postgresql -fecb53d46ed9e926973cdf5be1289c1ea71c2f68 dev/modules/stdlib +ab981422a67636441f1bfebaaade36aa690f1f25 dev/modules/stdlib 743e2a3facfd7b9596983bca0f5afef8336ea525 dev/modules/supervisord diff -r f36260133ed9 -r 6cbcec19079b dev/clean_dev.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dev/clean_dev.sh Wed Mar 12 16:52:58 2014 +0100 @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +pushd `dirname $0` > /dev/null +SCRIPTPATH=`pwd -P` +popd > /dev/null + +ROOTPATH="$SCRIPTPATH/.." + +pushd "$ROOTPATH" > /dev/null + +rm -rfv .installed.cfg .mr.developer.cfg parts/ eggs/ develop-eggs/ bin/ src/cm/settings_local.py src/cm/scripts/test-suite/workspace.info*.js +find . -name '*.pyc' -or -name '*.egg-info' | xargs rm -rvf + +popd > /dev/null + diff -r f36260133ed9 -r 6cbcec19079b dev/custom.yaml.tmpl --- a/dev/custom.yaml.tmpl Fri Mar 07 18:44:18 2014 +0100 +++ b/dev/custom.yaml.tmpl Wed Mar 12 16:52:58 2014 +0100 @@ -5,5 +5,14 @@ sysconfig::params::db_host : 127.0.0.1_custom sysconfig::params::db_port : 5433 -sysconfig::params::superuser_name : admin_custom -sysconfig::params::superuser_pw : dev@co-ment_custom \ No newline at end of file +sysconfig::params::testserver_port : 8001 + +sysconfig::params::superuser_name : admin_custom +sysconfig::params::superuser_pw : dev@co-ment_custom +sysconfig::params::user_edit_name : user-edit +sysconfig::params::user_edit_pw : user-edit@co-ment +sysconfig::params::user_com_name : user-com +sysconfig::params::user_com_pw : user-com@co-ment +sysconfig::params::user_observ_name : user-observ +sysconfig::params::user_observ_pw : user-observ@co-ment + diff -r f36260133ed9 -r 6cbcec19079b dev/modules/sysconfig/manifests/django_init.pp --- a/dev/modules/sysconfig/manifests/django_init.pp Fri Mar 07 18:44:18 2014 +0100 +++ b/dev/modules/sysconfig/manifests/django_init.pp Wed Mar 12 16:52:58 2014 +0100 @@ -1,6 +1,14 @@ class sysconfig::django_init ( - $superuser_name = hiera('sysconfig::params::superuser_name',$sysconfig::params::superuser_name), - $superuser_pw = hiera('sysconfig::params::superuser_pw',$sysconfig::params::superuser_pw) + $superuser_name = hiera('sysconfig::params::superuser_name' ,$sysconfig::params::superuser_name ), + $superuser_pw = hiera('sysconfig::params::superuser_pw' ,$sysconfig::params::superuser_pw ), + $user_edit_name = hiera('sysconfig::params::user_edit_name' ,$sysconfig::params::user_edit_name ), + $user_edit_pw = hiera('sysconfig::params::user_edit_pw' ,$sysconfig::params::user_edit_pw ), + $user_com_name = hiera('sysconfig::params::user_com_name' ,$sysconfig::params::user_com_name ), + $user_com_pw = hiera('sysconfig::params::user_com_pw' ,$sysconfig::params::user_com_pw ), + $user_observ_name = hiera('sysconfig::params::user_observ_name' ,$sysconfig::params::user_observ_name ), + $user_observ_pw = hiera('sysconfig::params::user_observ_pw' ,$sysconfig::params::user_observ_pw ), + $testserver_port = hiera('sysconfig::params::testserver_port' ,$sysconfig::params::testserver_port ) + ) inherits sysconfig::params { notify {'django_init': name => "\$superuser_name : ${superuser_name}, \$superuser_pw : ${superuser_pw}", withpath => true }-> @@ -31,7 +39,17 @@ owner => 'vagrant', group => 'vagrant', mode => 644, - content => template('sysconfig/workspace.info.js.erb'), + content => template('sysconfig/workspace.info.js.erb','sysconfig/url.workspace.info.js.erb'), + } + + file { 'karma_workspace_info_full': + ensure => 'present', + path => "/srv/comt/src/cm/scripts/test-suite/workspace.info.full.js", + replace => 'no', + owner => 'vagrant', + group => 'vagrant', + mode => 644, + content => template('sysconfig/workspace.info.js.erb','sysconfig/url.test.workspace.info.js.erb'), } } \ No newline at end of file diff -r f36260133ed9 -r 6cbcec19079b dev/modules/sysconfig/manifests/params.pp --- a/dev/modules/sysconfig/manifests/params.pp Fri Mar 07 18:44:18 2014 +0100 +++ b/dev/modules/sysconfig/manifests/params.pp Wed Mar 12 16:52:58 2014 +0100 @@ -9,7 +9,15 @@ $db_host_real = hiera('sysconfig::params::db_host',$db_host) $db_is_local = ($db_host_real == undef or !$db_host_real or $db_host_real=='127.0.0.1' or $db_host_real=='localhost') - $superuser_name = 'admin' - $superuser_pw = 'dev@co-ment' + $testserver_port = 8001 + + $superuser_name = 'admin' + $superuser_pw = 'dev@co-ment' + $user_edit_name = 'user-edit' + $user_edit_pw = 'user-edit@co-ment' + $user_com_name = 'user-com' + $user_com_pw = 'user-com@co-ment' + $user_observ_name = 'user-observ' + $user_observ_pw = 'user-observ@co-ment' } diff -r f36260133ed9 -r 6cbcec19079b dev/modules/sysconfig/templates/url.test.workspace.info.js.erb --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dev/modules/sysconfig/templates/url.test.workspace.info.js.erb Wed Mar 12 16:52:58 2014 +0100 @@ -0,0 +1,4 @@ + + +define ("WORKSPACE_URL", 'http://<%= @ipaddress_eth1 %>:<%= @testserver_port %>'); + diff -r f36260133ed9 -r 6cbcec19079b dev/modules/sysconfig/templates/url.workspace.info.js.erb --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dev/modules/sysconfig/templates/url.workspace.info.js.erb Wed Mar 12 16:52:58 2014 +0100 @@ -0,0 +1,4 @@ + + +define ("WORKSPACE_URL", 'http://<%= @ipaddress_eth1 %>'); + diff -r f36260133ed9 -r 6cbcec19079b dev/modules/sysconfig/templates/workspace.info.js.erb --- a/dev/modules/sysconfig/templates/workspace.info.js.erb Fri Mar 07 18:44:18 2014 +0100 +++ b/dev/modules/sysconfig/templates/workspace.info.js.erb Wed Mar 12 16:52:58 2014 +0100 @@ -6,7 +6,7 @@ }); } -define ("WORKSPACE_URL", 'http://<%= @ipaddress_eth1 %>/'); +//define ("WORKSPACE_URL", 'http://<%= @ipaddress_eth1 %>/'); define ("USER_ADMIN", '<%= @superuser_name %>'); define ("PASS_ADMIN", '<%= @superuser_pw %>'); @@ -15,13 +15,13 @@ // TODO: decide wether we should populate workspaces with standard users or // create them on the fly ? -define ("USER_EDIT", ''); -define ("PASS_EDIT", ''); +define ("USER_EDIT", '<%= @user_edit_name %>'); +define ("PASS_EDIT", '<%= @user_edit_pw %>'); -define ("USER_COM", ''); -define ("PASS_COM", ''); +define ("USER_COM", '<%= @user_com_name %>'); +define ("PASS_COM", '<%= @user_com_pw %>'); -define ("USER_OBSERV", ''); -define ("PASS_OBSERV", ''); +define ("USER_OBSERV", '<%= @user_observ_name %>'); +define ("PASS_OBSERV", '<%= @user_observ_pw %>'); diff -r f36260133ed9 -r 6cbcec19079b src/cm/fixtures/test_suite.yaml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/cm/fixtures/test_suite.yaml Wed Mar 12 16:52:58 2014 +0100 @@ -0,0 +1,372 @@ +- fields: {bcc: '', body: ' + + + You''ve been invited to join the workspace Workspace. + + Click the following link to complete your registration and access the workspace: + + + http://172.16.1.2//user/ZFejcKbK6Jz/activate/ + + -- + + Workspace + + http://172.16.1.2/ + + + ', created: !!timestamp '2014-03-09 14:40:10.221782', from_email: me@example.com, + message: 'Content-Type: text/plain; charset="utf-8" + + MIME-Version: 1.0 + + Content-Transfer-Encoding: quoted-printable + + Subject: [comt] Invitation + + From: me@example.com + + To: user-edit@example.com + + Date: Sun, 09 Mar 2014 13:40:10 -0000 + + Message-ID: <20140309134010.6531.16377@vagrant.vm> + + + + + You''ve been invited to join the workspace Workspace. + + Click the following link to complete your registration and access the works= + + pace: + + + http://172.16.1.2//user/ZFejcKbK6Jz/activate/ + + -- + + Workspace + + http://172.16.1.2/ + + + ', subject: '[comt] Invitation', to: user-edit@example.com} + model: cm.email + pk: 1 +- fields: {bcc: '', body: ' + + + You''ve been invited to join the workspace Workspace. + + Click the following link to complete your registration and access the workspace: + + + http://172.16.1.2//user/FIi2Txhmj8n/activate/ + + -- + + Workspace + + http://172.16.1.2/ + + + ', created: !!timestamp '2014-03-09 14:40:10.466353', from_email: me@example.com, + message: 'Content-Type: text/plain; charset="utf-8" + + MIME-Version: 1.0 + + Content-Transfer-Encoding: quoted-printable + + Subject: [comt] Invitation + + From: me@example.com + + To: user-com@example.com + + Date: Sun, 09 Mar 2014 13:40:10 -0000 + + Message-ID: <20140309134010.6531.70524@vagrant.vm> + + + + + You''ve been invited to join the workspace Workspace. + + Click the following link to complete your registration and access the works= + + pace: + + + http://172.16.1.2//user/FIi2Txhmj8n/activate/ + + -- + + Workspace + + http://172.16.1.2/ + + + ', subject: '[comt] Invitation', to: user-com@example.com} + model: cm.email + pk: 2 +- fields: {bcc: '', body: ' + + + You''ve been invited to join the workspace Workspace. + + Click the following link to complete your registration and access the workspace: + + + http://172.16.1.2//user/D4mEX8ggLl6/activate/ + + -- + + Workspace + + http://172.16.1.2/ + + + ', created: !!timestamp '2014-03-09 14:40:10.553388', from_email: me@example.com, + message: 'Content-Type: text/plain; charset="utf-8" + + MIME-Version: 1.0 + + Content-Transfer-Encoding: quoted-printable + + Subject: [comt] Invitation + + From: me@example.com + + To: user-observ@example.com + + Date: Sun, 09 Mar 2014 13:40:10 -0000 + + Message-ID: <20140309134010.6531.9295@vagrant.vm> + + + + + You''ve been invited to join the workspace Workspace. + + Click the following link to complete your registration and access the works= + + pace: + + + http://172.16.1.2//user/D4mEX8ggLl6/activate/ + + -- + + Workspace + + http://172.16.1.2/ + + + ', subject: '[comt] Invitation', to: user-observ@example.com} + model: cm.email + pk: 3 +- fields: {role: null, text: null, user: 1} + model: cm.userrole + pk: 1 +- fields: {role: null, text: null, user: null} + model: cm.userrole + pk: 2 +- fields: {role: 4, text: null, user: 3} + model: cm.userrole + pk: 4 +- fields: {role: 2, text: null, user: 2} + model: cm.userrole + pk: 3 +- fields: {role: 5, text: null, user: 4} + model: cm.userrole + pk: 5 +- fields: + anon: false + description: '' + global_scope: false + name: Manager + permissions: + - [can_create_comment, auth, permission] + - [can_create_text, auth, permission] + - [can_delete_comment, auth, permission] + - [can_delete_text, auth, permission] + - [can_edit_comment, auth, permission] + - [can_edit_comment_own, auth, permission] + - [can_edit_text, auth, permission] + - [can_manage_text, auth, permission] + - [can_manage_workspace, auth, permission] + - [can_view_approved_comment, auth, permission] + - [can_view_text, auth, permission] + - [can_view_unapproved_comment, auth, permission] + - [can_view_workspace, auth, permission] + model: cm.role + pk: 1 +- fields: + anon: false + description: '' + global_scope: false + name: Editor + permissions: + - [can_create_comment, auth, permission] + - [can_create_text, auth, permission] + - [can_delete_comment, auth, permission] + - [can_delete_text, auth, permission] + - [can_edit_comment, auth, permission] + - [can_edit_comment_own, auth, permission] + - [can_edit_text, auth, permission] + - [can_view_approved_comment, auth, permission] + - [can_view_text, auth, permission] + - [can_view_unapproved_comment, auth, permission] + - [can_view_workspace, auth, permission] + model: cm.role + pk: 2 +- fields: + anon: false + description: '' + global_scope: false + name: Moderator + permissions: + - [can_create_comment, auth, permission] + - [can_delete_comment, auth, permission] + - [can_edit_comment, auth, permission] + - [can_edit_comment_own, auth, permission] + - [can_view_approved_comment, auth, permission] + - [can_view_text, auth, permission] + - [can_view_unapproved_comment, auth, permission] + - [can_view_workspace, auth, permission] + model: cm.role + pk: 3 +- fields: + anon: true + description: '' + global_scope: false + name: Commentator + permissions: + - [can_create_comment, auth, permission] + - [can_delete_comment_own, auth, permission] + - [can_edit_comment_own, auth, permission] + - [can_view_approved_comment, auth, permission] + - [can_view_text, auth, permission] + - [can_view_workspace, auth, permission] + model: cm.role + pk: 4 +- fields: + anon: true + description: '' + global_scope: false + name: Observer + permissions: + - [can_view_approved_comment, auth, permission] + - [can_view_text, auth, permission] + - [can_view_workspace, auth, permission] + model: cm.role + pk: 5 +- fields: {adminkey: Nh3JW2XlHuh, allow_contact: true, created: !!timestamp '2014-03-09 + 14:31:20.046862', is_email_error: false, is_suspended: false, is_temp: false, + key: LwBZ7cHJJiH, modified: !!timestamp '2014-03-09 14:31:20.046828', preferred_language: en, + tags: '', user: 1} + model: cm.userprofile + pk: 1 +- fields: {adminkey: ZFejcKbK6Jz, allow_contact: true, created: !!timestamp '2014-03-09 + 14:40:10.170598', is_email_error: false, is_suspended: false, is_temp: false, + key: kTXakgKTeSA, modified: !!timestamp '2014-03-09 14:40:10.179872', preferred_language: en, + tags: '', user: 2} + model: cm.userprofile + pk: 2 +- fields: {adminkey: FIi2Txhmj8n, allow_contact: true, created: !!timestamp '2014-03-09 + 14:40:10.431145', is_email_error: false, is_suspended: false, is_temp: false, + key: 3sh3WZqNzXs, modified: !!timestamp '2014-03-09 14:40:10.451764', preferred_language: en, + tags: '', user: 3} + model: cm.userprofile + pk: 3 +- fields: {adminkey: D4mEX8ggLl6, allow_contact: true, created: !!timestamp '2014-03-09 + 14:40:10.510804', is_email_error: false, is_suspended: false, is_temp: false, + key: q9WLLDvaR4U, modified: !!timestamp '2014-03-09 14:40:10.529488', preferred_language: en, + tags: '', user: 4} + model: cm.userprofile + pk: 4 +- fields: {comment: null, created: !!timestamp '2014-03-09 14:40:10.411506', ip: 127.0.0.1, + originator_user: 1, text: null, text_version: null, type: user_created, user: 2} + model: cm.activity + pk: 1 +- fields: {comment: null, created: !!timestamp '2014-03-09 14:40:10.495868', ip: 127.0.0.1, + originator_user: 1, text: null, text_version: null, type: user_created, user: 3} + model: cm.activity + pk: 2 +- fields: {comment: null, created: !!timestamp '2014-03-09 14:40:10.605856', ip: 127.0.0.1, + originator_user: 1, text: null, text_version: null, type: user_created, user: 4} + model: cm.activity + pk: 3 +- fields: {comment: null, created: !!timestamp '2014-03-09 15:28:33.969806', ip: 127.0.0.1, + originator_user: 2, text: null, text_version: null, type: user_activated, user: 2} + model: cm.activity + pk: 4 +- fields: {comment: null, created: !!timestamp '2014-03-09 21:47:31.032761', ip: 127.0.0.1, + originator_user: 3, text: null, text_version: null, type: user_activated, user: 3} + model: cm.activity + pk: 5 +- fields: {comment: null, created: !!timestamp '2014-03-09 21:48:56.495739', ip: 127.0.0.1, + originator_user: 4, text: null, text_version: null, type: user_activated, user: 4} + model: cm.activity + pk: 6 +- fields: + date_joined: 2014-03-08 15:12:44.112501 + email: admin@mail.com + first_name: '' + groups: [] + is_active: true + is_staff: true + is_superuser: true + last_login: 2014-03-09 14:31:20.062015 + last_name: '' + password: sha1$46d5d$f808afd06c731b7b4cf97919165183b497a620df + user_permissions: [] + username: admin + model: auth.user + pk: 1 +- fields: + date_joined: 2014-03-09 14:40:10.165655 + email: user-edit@example.com + first_name: Edit + groups: [] + is_active: true + is_staff: false + is_superuser: false + last_login: 2014-03-09 21:45:49.613035 + last_name: User + password: sha1$9e514$feb09c455f7c440f587675251b9a3daced561547 + user_permissions: [] + username: user-edit + model: auth.user + pk: 2 +- fields: + date_joined: 2014-03-09 14:40:10.426754 + email: user-com@example.com + first_name: Com + groups: [] + is_active: true + is_staff: false + is_superuser: false + last_login: 2014-03-09 21:47:31.027912 + last_name: User + password: sha1$5504c$55eb5e3692d903c74a28589d9861fc0e2c7af7b3 + user_permissions: [] + username: user-com + model: auth.user + pk: 3 +- fields: + date_joined: 2014-03-09 14:40:10.501372 + email: user-observ@example.com + first_name: Observ + groups: [] + is_active: true + is_staff: false + is_superuser: false + last_login: 2014-03-09 21:48:56.491761 + last_name: User + password: sha1$25ec8$f73bf7f6a0bba01d05b0df89aebed759713e7151 + user_permissions: [] + username: user-observ + model: auth.user + pk: 4 diff -r f36260133ed9 -r 6cbcec19079b src/cm/scripts/test-suite/clean-testserver.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/cm/scripts/test-suite/clean-testserver.sh Wed Mar 12 16:52:58 2014 +0100 @@ -0,0 +1,16 @@ +#!/bin/bash + +PID=$(cat /tmp/testserver.pid|cut -d"|" -f1) +OUTFILE=$(cat /tmp/testserver.pid|cut -d"|" -f2) + +echo "Kill test server pid $PID" +kill $PID + +echo "Test server log:" +echo "================================================================================" +cat "$OUTFILE" +echo "================================================================================" + +echo "Clean testserver output" +rm "$OUTFILE" + diff -r f36260133ed9 -r 6cbcec19079b src/cm/scripts/test-suite/karma.conf.full.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/cm/scripts/test-suite/karma.conf.full.js Wed Mar 12 16:52:58 2014 +0100 @@ -0,0 +1,52 @@ +// Karma configuration +// Generated on Wed Jan 29 2014 15:32:16 GMT+0100 (CET) + + +// SID: get WORKSPACE_URL configuration from one single file to customize +var w = require ('./workspace.info.full.js'); + +module.exports = function(config) { + config.set({ + // list of files or patterns to load in the browser, from current directory + files: [ + {pattern: 'tests/**/*.js', included: true} + ], + // list of files to exclude + exclude: [ + ], + // Start these browsers, currently available: + // - Firefox ; Safari (only Mac; run `npm install karma-safari-launcher` first) + // - Chrome ; ChromeCanary ; Opera (run `npm install karma-opera-launcher` first) + // - PhantomJS ; IE (only Windows; run `npm install karma-ie-launcher` first) + browsers: w.BROWSERS, + // frameworks to use. SID: choosen mocha, added karma-e2e-dsl (end-to-end testing) + frameworks: ['mocha', 'karma-e2e-dsl'], + // SID: Karma will start and run somewhere else than '/', to allow proxying '/' + urlRoot: '/karma/', + // SID: directive added on karma-e2e-dsl purpose. Map of path-proxy pairs. + proxies: { + '/': w.WORKSPACE_URL + }, + client: { + mocha: { + ui: 'tdd' + }, + w: w // SID: exports the variable in the test execution browser window + }, + // test results reporter to use : 'dots', 'progress', 'junit', 'growl', 'coverage' + reporters: ['progress'], + // web server port + port: 9876, + // enable / disable colors in the output (reporters and logs) + colors: true, + // level of logging : config.LOG_DISABLE || _ERROR || _WARN || _INFO || _DEBUG + logLevel: config.LOG_INFO || config.LOG_DEBUG, + // enable / disable watching file and executing tests whenever any file changes + autoWatch: false, + // If browser does not capture in given timeout [ms], kill it + captureTimeout: 20000, + // Continuous Integration mode : if true, it capture browsers, run tests and exit + // singleRun: false + singleRun: true, + }); +}; diff -r f36260133ed9 -r 6cbcec19079b src/cm/scripts/test-suite/start-test-suite-full.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/cm/scripts/test-suite/start-test-suite-full.sh Wed Mar 12 16:52:58 2014 +0100 @@ -0,0 +1,51 @@ +#!/bin/bash + +echo "---------------------" +echo "Starting test server" + +pushd ../../../../dev > /dev/null +vagrant ssh -c "/srv/comt/src/cm/scripts/test-suite/start-testserver.sh" +popd > /dev/null + +SERVER_IP=`grep WORKSPACE_URL workspace.info.full.js | tail -n -1 | cut -d: -f2 | tr -d " //"` +SERVER_PORT=`grep WORKSPACE_URL ./workspace.info.full.js | tail -n -1 | cut -d: -f3 | tr -d " ');"` + +if [[ -x `which nc` ]]; then + SERVER_TEST_CMD="nc -z $SERVER_IP $SERVER_PORT" +elif [[ -x `which curl` ]]; then + SERVER_TEST_CMD="curl --output /dev/null --silent --head --fail http://$SERVER_IP:$SERVER_PORT" +elif [[ -x `which wget` ]]; then + SERVER_TEST_CMD="wget -q --spider http://$SERVER_IP:$SERVER_PORT" +fi +echo "$SERVER_TEST_CMD" + +echo "---------------------" +if [[ -z "$SERVER_TEST_CMD" ]]; then + echo "Waiting 10 seconds to let test server start" + sleep 10 +else + for i in {1..10}; do + echo "waiting 5 seconds to let the test server $SERVER_IP:$SERVER_PORT start" + sleep 5 + if $SERVER_TEST_CMD; then + break + fi + done + if [ $i -eq 10 ]; then + echo "could not start test server $SERVER_IP:$SERVER_PORT" + exit 1 + fi +fi + +echo "---------------------" +echo "Starting karma tests" +. ./start-test-suite.sh ./karma.conf.full.js $@ + +echo "---------------------" +echo "stopping test server + output test server logs" + +pushd ../../../../dev > /dev/null +vagrant ssh -c "/srv/comt/src/cm/scripts/test-suite/clean-testserver.sh" +popd /dev/null + + diff -r f36260133ed9 -r 6cbcec19079b src/cm/scripts/test-suite/start-test-suite.sh --- a/src/cm/scripts/test-suite/start-test-suite.sh Fri Mar 07 18:44:18 2014 +0100 +++ b/src/cm/scripts/test-suite/start-test-suite.sh Wed Mar 12 16:52:58 2014 +0100 @@ -4,14 +4,24 @@ if [ -z "$CHROME_BIN" ]; then export CHROME_BIN=`which chrome` fi +if [[ -z "$CHROME_BIN" && $OSTYPE =~ ^darwin ]]; then + CHROME_BIN_BASE=`mdfind "kMDItemCFBundleIdentifier == 'com.google.Chrome'"` + export CHROME_BIN="$CHROME_BIN_BASE/Contents/MacOS/Google Chrome" +fi export PHANTOMJS_BIN=`which phantomjs` +export FIREFOX_BIN=`which firefox` +if [[ -z "$FIREFOX_BIN" && $OSTYPE =~ ^darwin ]]; then + FIREFOX_BIN_BASE=`mdfind "kMDItemCFBundleIdentifier == 'org.mozilla.firefox'"` + export FIREFOX_BIN="$FIREFOX_BIN_BASE/Contents/MacOS/firefox" +fi + if [ -x ./node_modules/.bin/karma ]; then KARMA=./node_modules/.bin/karma else KARMA=`which karma` fi -"$KARMA" start +"$KARMA" start $@ diff -r f36260133ed9 -r 6cbcec19079b src/cm/scripts/test-suite/start-testserver.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/cm/scripts/test-suite/start-testserver.sh Wed Mar 12 16:52:58 2014 +0100 @@ -0,0 +1,17 @@ +#!/bin/bash + +pushd `dirname $0` > /dev/null +SCRIPTPATH=`pwd -P` +popd > /dev/null + +ROOTPATH=$(readlink -m "$SCRIPTPATH/../../../..") +TMPFILE=`mktemp` + +pushd "$ROOTPATH" > /dev/null + +nohup bin/django testserver --noinput --addrport=0.0.0.0:8001 initial_data roles_generic test_suite > $TMPFILE 2>&1 & +echo "$!|$TMPFILE" > /tmp/testserver.pid + +cat /tmp/testserver.pid + +popd > /dev/null