~sseman/juju-ci-tools/model-change-watcher-py3-2

« back to all changes in this revision

Viewing changes to run-unit-tests

  • Committer: Aaron Bentley
  • Date: 2014-02-21 19:46:13 UTC
  • mfrom: (233.1.20 manual-provider)
  • mto: This revision was merged to the branch mainline in revision 252.
  • Revision ID: aaron.bentley@canonical.com-20140221194613-3dai5kb0d9uwtca8
Support manual provider tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/bin/bash
2
2
set -eux
3
3
: ${LOCAL_JENKINS_URL=$JENKINS_URL}
4
 
INSTANCE_TYPE=$1
5
 
AMI_IMAGE=$2
 
4
export INSTANCE_TYPE=$1
 
5
export AMI_IMAGE=$2
6
6
tarfile=$($SCRIPTS/get-tarfile-name $revision_build)
7
 
RUN_OUTPUT=$(euca-run-instances -k id_rsa -t $INSTANCE_TYPE $AMI_IMAGE)
8
 
if [ $? -ne 0 ]; then
9
 
  exit 1
10
 
fi
11
 
 
12
 
instance_id=$(echo $RUN_OUTPUT|sed -r 's/.*INSTANCE (i-[^ ]*) .*/\1/')
 
7
instance_id=$($SCRIPTS/ec2-run-instance-get-id)
13
8
set +x
14
9
echo Starting instance $instance_id
15
 
instance_ip=''
16
 
echo -n Waiting for IP address
17
 
while [ -z "$instance_ip" ]; do
18
 
  sleep 1
19
 
  instance_ip=$(euca-describe-instances $instance_id|sed '/^INSTANCE/!d'|cut -f 17)
20
 
  echo -n .
21
 
done
22
 
echo
23
 
echo Instance has ip $instance_ip
 
10
instance_name=$($SCRIPTS/ec2-get-name $instance_id)
 
11
echo Instance has ip $instance_name
24
12
sleep 30
25
 
echo -n Waiting for SSH
26
 
while ! netcat $instance_ip 22 -w 1 -q 0 </dev/null >/dev/null; do
27
 
  sleep 1
28
 
  echo -n .
29
 
done
30
 
echo
 
13
$SCRIPTS/wait-for-port $instance_name 22
31
14
set -x
32
15
set +e
33
 
ssh ubuntu@$instance_ip -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" <<EOT
 
16
ssh ubuntu@$instance_name -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" <<EOT
34
17
set -eux
35
18
ssh-keygen -t rsa -b 2048 -N "" -f ~/.ssh/id_rsa
36
19
wget -q $JENKINS_URL/job/build-revision/$revision_build/artifact/$tarfile