Merge lp:~jml/canonical-identity-provider/acceptance-script into lp:canonical-identity-provider/release

Proposed by Jonathan Lange
Status: Merged
Approved by: Jonathan Lange
Approved revision: no longer in the source branch.
Merged at revision: 593
Proposed branch: lp:~jml/canonical-identity-provider/acceptance-script
Merge into: lp:canonical-identity-provider/release
Diff against target: 105 lines (+86/-0)
4 files modified
scripts/local.cfg-dev (+12/-0)
scripts/local.cfg-production (+8/-0)
scripts/local.cfg-staging (+9/-0)
scripts/run-acceptance-tests (+57/-0)
To merge this branch: bzr merge lp:~jml/canonical-identity-provider/acceptance-script
Reviewer Review Type Date Requested Status
Natalia Bidart (community) Approve
Review via email: mp+142313@code.launchpad.net

Commit message

Move acceptance scripts to source tree

Description of the change

Rather than keep the details of how to run acceptance tests in the Jenkins
config, it's probably better to keep it in the source tree.

This branch does that. It combines the configurations from:

  http://razorgirl.info/job/sso-acceptance-dev/configure
  http://razorgirl.info/job/sso-acceptance-staging/configure
  http://razorgirl.info/job/sso-acceptance-production/configure

Into one script. It's not a great script, but it already has less duplication
than those configs.

It is possible that the script acceptance-dev.sh could be helpfully broken
up into something that launches the dev server and then outputs details
which can then be used to run this new script against it. That's outside
the scope of this branch.

Reviewer: please check to see that this script is equivalent to the configs,
sane, and doesn't include any revealing data.

Thanks,
jml

To post a comment you must log in.
Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Looks good to me!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'scripts/local.cfg-dev'
2--- scripts/local.cfg-dev 1970-01-01 00:00:00 +0000
3+++ scripts/local.cfg-dev 2013-01-08 14:36:22 +0000
4@@ -0,0 +1,12 @@
5+[__noschema__]
6+basedir = .
7+db_host =
8+hostname = localhost:$PORT
9+
10+[__main__]
11+includes =
12+ ../branches/project/config/devel.cfg
13+ ../branches/project/config/acceptance-dev.cfg
14+
15+[django]
16+debug = false
17
18=== added file 'scripts/local.cfg-production'
19--- scripts/local.cfg-production 1970-01-01 00:00:00 +0000
20+++ scripts/local.cfg-production 2013-01-08 14:36:22 +0000
21@@ -0,0 +1,8 @@
22+[__noschema__]
23+basedir = .
24+db_host =
25+
26+[__main__]
27+includes =
28+ ../branches/project/config/devel.cfg
29+ ../branches/project/config/acceptance.cfg
30
31=== added file 'scripts/local.cfg-staging'
32--- scripts/local.cfg-staging 1970-01-01 00:00:00 +0000
33+++ scripts/local.cfg-staging 2013-01-08 14:36:22 +0000
34@@ -0,0 +1,9 @@
35+[__noschema__]
36+basedir = .
37+db_host =
38+
39+[__main__]
40+includes =
41+ ../branches/project/config/devel.cfg
42+ ../branches/project/config/acceptance.cfg
43+
44
45=== added file 'scripts/run-acceptance-tests'
46--- scripts/run-acceptance-tests 1970-01-01 00:00:00 +0000
47+++ scripts/run-acceptance-tests 2013-01-08 14:36:22 +0000
48@@ -0,0 +1,57 @@
49+#!/bin/sh
50+#
51+# ./scripts/run-acceptance-tests -- run acceptance tests for an environment.
52+#
53+# Usage: ./scripts/run-acceptance-tests ENVIRONMENT CONFIG_BRANCH FLAGS
54+#
55+# where:
56+# - ENVIRONMENT is one of "production", "dev" or "staging".
57+# - CONFIG_BRANCH is the URL of a branch that will live in branches/project
58+# - FLAGS are the flags to pass to 'fab acceptance'. Not needed for "dev".
59+# Recommended FLAGS for staging and production is "twofactor;paper_device"
60+
61+set -e
62+
63+TARGET=$1
64+CONFIG_BRANCH=$2
65+FLAGS=$3
66+
67+
68+if [ "$TARGET" = "production" ]; then
69+ SST_BASE_URL=https://login.ubuntu.com
70+elif [ "$TARGET" = "staging" ]; then
71+ SST_BASE_URL=https://login.staging.ubuntu.com
72+else
73+ SST_BASE_URL=""
74+fi
75+
76+
77+# Some Jenkins jobs copy workspace.tar.gz from successful build.
78+if [ -r "workspace.tar.gz" ]; then
79+ tar zxf workspace.tar.gz -C .
80+fi
81+
82+# make sure that dependencies are up to date
83+fab bootstrap
84+if [ -d branches/project ]; then
85+ cd branches/project
86+ bzr pull
87+else
88+ bzr branch ${CONFIG_BRANCH} branches/project
89+fi
90+
91+# Set up the correct Django configuration.
92+rm django_project/local.cfg
93+ln -s local.cfg-${TARGET} django_project/local.cfg
94+
95+# clean old results
96+rm -rf results/*
97+
98+
99+# run tests
100+if [ ${TARGET} = "dev" ]; then
101+ # dev is special: we need to start it up.
102+ ./scripts/acceptance-dev.sh
103+else
104+ SST_BASE_URL=$SST_BASE_URL fab acceptance:screenshot=true,report=xml,extended=true,flags=$FLAGS
105+fi