~andrewjbeach/juju-ci-tools/get-juju-dict

1062.1.1 by seman.said at canonical
Use workspace runner for the client-server tests.
1
#!/bin/bash
1080.2.3 by seman.said at canonical
Moved the translation logic from the compatibility-control job into the run-client-server-test.bash script
2
set -eu
1062.1.1 by seman.said at canonical
Use workspace runner for the client-server tests.
3
SCRIPTS=$(readlink -f $(dirname $0))
1080.2.1 by seman.said at canonical
Updated the osx client-server test script.
4
export PATH=$HOME/workspace-runner:$PATH
1062.1.1 by seman.said at canonical
Use workspace runner for the client-server tests.
5
6
usage() {
1303.2.1 by Aaron Bentley
Use revision-build for parallel streams.
7
    echo "usage: $0 old-version candidate-version candidate-revision-build new-to-old client-os log-dir"
1062.1.1 by seman.said at canonical
Use workspace runner for the client-server tests.
8
    exit 1
9
}
1303.2.1 by Aaron Bentley
Use revision-build for parallel streams.
10
test $# -eq 6 || usage
1080.2.3 by seman.said at canonical
Moved the translation logic from the compatibility-control job into the run-client-server-test.bash script
11
old_version="$1"
12
candidate_version="$2"
1303.2.1 by Aaron Bentley
Use revision-build for parallel streams.
13
revision_build="$3"
14
new_to_old="$4"
15
client_os="$5"
16
local_log_dir="$6"
1080.2.3 by seman.said at canonical
Moved the translation logic from the compatibility-control job into the run-client-server-test.bash script
17
18
set -x
1091.4.1 by James Tunnicliffe
Merged upstream
19
1303.2.1 by Aaron Bentley
Use revision-build for parallel streams.
20
parallel_url="http://juju-dist.s3.amazonaws.com/parallel-testing/agents"
21
if [[ "$new_to_old" == "true" ]]; then
22
    echo "Using parallel streams for candidate."
23
    agent_arg="--agent-stream revision-build-$revision_build"
24
    agent_arg="$agent_arg --agent-url $parallel_url"
1091.4.1 by James Tunnicliffe
Merged upstream
25
else
26
    echo "Using official proposed (or released) streams"
27
    agent_arg="--agent-stream proposed"
28
fi
29
30
1080.2.3 by seman.said at canonical
Moved the translation logic from the compatibility-control job into the run-client-server-test.bash script
31
if [[ "$client_os" == "ubuntu" ]]; then
1091.4.1 by James Tunnicliffe
Merged upstream
32
    if [[ -d $HOME/old-juju/$candidate_version ]]; then
33
        candidate_juju=$(find $HOME/old-juju/$candidate_version -name juju)
34
    else
35
        candidate_juju=$(find $HOME/candidate/$candidate_version -name juju)
36
    fi
1114.1.1 by seman.said at canonical
Updated to look for Juju in old-juju dir first then in candidate dir.
37
    old_juju=$(find $HOME/old-juju/$old_version -name juju)
1091.4.1 by James Tunnicliffe
Merged upstream
38
    server=$old_juju
39
    client=$candidate_juju
40
    if [[ "$new_to_old" == "true" ]]; then
41
        server=$candidate_juju
42
        client=$old_juju
43
    fi
44
    echo "Server: " `$server --version`
45
    echo "Client: " `$client --version`
1080.2.3 by seman.said at canonical
Moved the translation logic from the compatibility-control job into the run-client-server-test.bash script
46
elif [[ "$client_os" == "osx" ]]; then
47
    user_at_host="jenkins@osx-slave.vapour.ws"
48
    remote_script="run-client-server-test-remote.bash"
49
elif [[ "$client_os" == "windows" ]]; then
1091.4.1 by James Tunnicliffe
Merged upstream
50
    remote_script="run-win-client-server-remote.bash"
1080.2.3 by seman.said at canonical
Moved the translation logic from the compatibility-control job into the run-client-server-test.bash script
51
    user_at_host="Administrator@win-slave.vapour.ws"
52
else
53
    echo "Unkown client OS."
54
    exit 1
55
fi
56
1091.4.1 by James Tunnicliffe
Merged upstream
57
remote_log_dir="logs"
1080.2.3 by seman.said at canonical
Moved the translation logic from the compatibility-control job into the run-client-server-test.bash script
58
run_remote_script() {
59
    cat > temp-config.yaml <<EOT
1062.1.1 by seman.said at canonical
Use workspace runner for the client-server tests.
60
install:
1080.2.1 by seman.said at canonical
Updated the osx client-server test script.
61
    remote:
62
        - $SCRIPTS/$remote_script
1091.4.1 by James Tunnicliffe
Merged upstream
63
command: [remote/$remote_script, "$candidate_version", "$old_version", "$new_to_old", "$remote_log_dir", "$agent_arg"]
64
download-dir:
65
    $remote_log_dir: "$local_log_dir"
1062.1.1 by seman.said at canonical
Use workspace runner for the client-server tests.
66
EOT
1091.4.1 by James Tunnicliffe
Merged upstream
67
    workspace-run temp-config.yaml $user_at_host -v
1080.2.3 by seman.said at canonical
Moved the translation logic from the compatibility-control job into the run-client-server-test.bash script
68
}
1080.2.1 by seman.said at canonical
Updated the osx client-server test script.
69
1080.2.3 by seman.said at canonical
Moved the translation logic from the compatibility-control job into the run-client-server-test.bash script
70
set +e
71
for i in `seq 1 2`; do
72
    if [[ "$client_os" == "ubuntu" ]]; then
1138.1.1 by Aaron Bentley
Adjust for env rename.
73
        $SCRIPTS/assess_heterogeneous_control.py $server $client parallel-reliability-aws $JOB_NAME $local_log_dir $agent_arg
1080.2.3 by seman.said at canonical
Moved the translation logic from the compatibility-control job into the run-client-server-test.bash script
74
    else
75
        run_remote_script
76
    fi
1085.1.1 by seman.said at canonical
Cleanup the compatibility-control temp dir.
77
    RESULT=$?
78
    if [[ $RESULT == 0 ]]; then
1080.2.3 by seman.said at canonical
Moved the translation logic from the compatibility-control job into the run-client-server-test.bash script
79
        break
80
    fi
1085.1.1 by seman.said at canonical
Cleanup the compatibility-control temp dir.
81
    if [[ $i == 1 ]]; then
82
        # Don't remove the log if it fails on the second try.
1091.4.1 by James Tunnicliffe
Merged upstream
83
        rm -rf $local_log_dir/*
1085.1.1 by seman.said at canonical
Cleanup the compatibility-control temp dir.
84
    fi
1080.2.3 by seman.said at canonical
Moved the translation logic from the compatibility-control job into the run-client-server-test.bash script
85
done
1091.4.1 by James Tunnicliffe
Merged upstream
86
exit $RESULT
1118.1.2 by seman.said at canonical
Removed --debug.
87