2
# Run the uitests with the juju created from the release tar file
3
# or from the approximate source of the tar file.
6
# We require "TestJujuCore" SUITE to verify Juju's interaction with the GUI.
7
# The "TestCharm" SUITE verifies charm plugin deps with juju.
8
# "not TestStorefront" Theoretically work if we accept the consequences
9
# of building both Juju and the charm plugin with undocumented deps.
10
# "TestStorefront" fails, maybe because of phantom. firefox reports
11
# Xvfb did not start, but xfvb works for the win client job.
12
# SUITE cannot be an empty string if non-essential suites will fail.
13
# see http://pytest.org/latest/example/markers.html#using-k-expr-to-select-tests-based-on-their-name
14
# for the syntax supported by $SUITE.
18
export SCRIPTS=$HOME/juju-ci-tools
19
export RELEASE_TOOLS=$HOME/juju-release-tools
20
export JUJU_UITEST=$HOME/eco-repos/src/github.com/CanonicalLtd/juju-uitest
21
export CLOUD_CITY=$HOME/cloud-city
22
export S3_CONFIG=$CLOUD_CITY/juju-qa.s3cfg
23
source $CLOUD_CITY/staging-charm-store.rc
26
export PATH=/usr/lib/go-1.6/bin:$PATH
28
REVISION_BUILD=${1:-$revision_build}
29
SUITE=${2:-TestJujuCore}
30
JOB_NAME=${3:-juju-with-uitest}
31
WORKSPACE=${4:-$WORKSPACE}
33
# Setup a workspace and TMPDIR to keep all test files in one place.
34
if [[ -z $WORKSPACE || $WORKSPACE == './' || $WORKSPACE == './' ]]; then
35
echo "Set a sane WORKSPACE: [$WORKSPACE] is not safe."
38
WORKSPACE=$(readlink -f $WORKSPACE)
39
$SCRIPTS/jujuci.py -v setup-workspace $WORKSPACE
40
export TMPDIR="$WORKSPACE/tmp"
43
# uitest only supports master and near tip branches.
44
# This is a design flaw because 1.25 will live a long time and
45
# we want to catch API breakages with the GUI.
46
source $($SCRIPTS/s3ci.py get --config $S3_CONFIG $REVISION_BUILD build-revision buildvars.bash)
47
if [[ $VERSION =~ ^1\..*$ ]]; then
48
echo "$VERSION is not supported uitests"
52
# Print a summary for the jenkins job description.
53
$SCRIPTS/s3ci.py get-summary $REVISION_BUILD $JOB_NAME
55
# Get the pristine tarfile and unpack it to build a tainted testing juju.
56
JUJU_ARCHIVE=$($SCRIPTS/s3ci.py get --config $S3_CONFIG $REVISION_BUILD build-revision juju-core_.*.tar.gz)
58
JUJU_DIR=$(basename $JUJU_ARCHIVE .tar.gz)
59
export GOPATH=$WORKSPACE/$JUJU_DIR
60
JUJU_PACKAGE=$GOPATH/src/github.com/juju/juju
61
CHARM_PACKAGE=$GOPATH/src/github.com/juju/charm
62
# Add the charm package to the tree.
63
go get github.com/juju/charm/...
65
# If tree must be tampered with, then let it be us who do it to ensure
66
# we understand what is not being tested.
67
CSCLIENT="$GOPATH/src/gopkg.in/juju/charmrepo.v2-unstable/csclient/csclient.go"
68
API_URL=$(echo $STORE_URL | sed -e "s,//,//api.,")
69
SERVER_PATTERN="s,https://api.jujucharms.com,$API_URL,"
70
sed -i -e "$SERVER_PATTERN" $CSCLIENT
71
for PACKAGE in $JUJU_PACKAGE $CHARM_PACKAGE; do
78
# Get the releases Juju GUI.
79
GUI_URL=$(sstream-query http://streams.canonical.com/juju/gui/streams/v1/index.json --output-format="%(item_url)s" | head -1)
80
GUI_ARCHIVE=$(basename $GUI_URL)
83
# Create credentials for the TestJujuCore tests.
84
# We really want a helper script based on deploy_stack.py to create
85
# an arbitrary temp env from cloud-city.
86
export JUJU_DATA=$CLOUD_CITY/jes-homes/$JOB_NAME
87
export JUJU_HOME=$JUJU_DATA
88
test -d $JUJU_DATA && rm -r $JUJU_DATA
90
cat << EOT > $JUJU_DATA/credentials.yaml
93
default-region: us-central1
94
default-credential: juju-qa
97
file: $CLOUD_CITY/gce-4f8322be6f89.json
100
# Setup juju-uitest from the local copy.
101
cp -r $JUJU_UITEST $WORKSPACE/juju-uitest
102
cd $WORKSPACE/juju-uitest
106
# Do not reveal credentials.
107
echo "devenv/bin/uitest --driver phantom \
109
--gui-archive $WORKSPACE/$GUI_ARCHIVE \
111
--credentials <SECRET> \
116
devenv/bin/uitest --driver phantom \
118
--gui-archive $WORKSPACE/$GUI_ARCHIVE \
120
--credentials $STORE_CREDENTIALS \
121
--admin $STORE_ADMIN \