Merge lp:~mbruzek/charms/trusty/ubuntu/trunk into lp:charms/trusty/ubuntu

Proposed by Matt Bruzek on 2015-02-19
Status: Merged
Merged at revision: 8
Proposed branch: lp:~mbruzek/charms/trusty/ubuntu/trunk
Merge into: lp:charms/trusty/ubuntu
Diff against target: 113 lines (+38/-28)
2 files modified
tests/00-setup.sh (+15/-7)
tests/10-deploy-test.py (+23/-21)
To merge this branch: bzr merge lp:~mbruzek/charms/trusty/ubuntu/trunk
Reviewer Review Type Date Requested Status
Review Queue (community) automated testing Approve on 2015-02-19
Charles Butler (community) 2015-02-19 Approve on 2015-02-19
Review via email: mp+250362@code.launchpad.net

Description of the change

Making the tests work with the trusty series.

To post a comment you must log in.
Matt Bruzek (mbruzek) wrote :

I noticed the amulet test in ubuntu deployed precise version of ubuntu. I fixed that and added more smarts in the test.

Charles Butler (lazypower) wrote :

Thanks for the contribution mbruzek. I'm confident these changes are solid - they passed my local testing. I just kicked off a CI job and will merge once the results come back green. +1

Charles Butler (lazypower) wrote :
review: Approve
Review Queue (review-queue) wrote :

The results (PASS) are in and available here: http://reports.vapour.ws/charm-tests/charm-bundle-test-11045-results

review: Approve (automated testing)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'tests/00-setup.sh'
--- tests/00-setup.sh 2014-01-25 03:15:50 +0000
+++ tests/00-setup.sh 2015-02-19 18:14:52 +0000
@@ -1,7 +1,15 @@
1#!/bin/sh1#!/bin/bash
22
3# Install Amulet testing harness as it is not on the 3# This script runs first to set up the environment for the tests.
4# default cloud image. Amulet should pull in its dependencies.4
5sudo add-apt-repository -y ppa:juju/stable5set -x
6sudo apt-get update 6
7sudo apt-get install -y amulet7# Check if amulet is installed before adding repository and updating apt-get.
8dpkg -s amulet
9if [ $? -ne 0 ]; then
10 sudo add-apt-repository -y ppa:juju/stable
11 sudo apt-get update -qq
12 sudo apt-get install -y amulet
13fi
14# Install any additional packages needed for tests here.
15
816
=== modified file 'tests/10-deploy-test.py'
--- tests/10-deploy-test.py 2014-01-25 03:15:50 +0000
+++ tests/10-deploy-test.py 2015-02-19 18:14:52 +0000
@@ -3,18 +3,17 @@
3# This Amulet based tests3# This Amulet based tests
4# The goal is to ensure the Ubuntu charm4# The goal is to ensure the Ubuntu charm
5# sucessfully deploys and can be accessed.5# sucessfully deploys and can be accessed.
6# Note the Ubuntu charm does not have any 6# Note the Ubuntu charm does not have any
7# relations or config options.7# relations or config options.
88
9import amulet9import amulet
10#import os
11#import requests
1210
13# Timeout value, in seconds to deploy the environment11# Timeout value, in seconds to deploy the environment
14seconds = 90012seconds = 900
13series = 'trusty'
1514
16# Set up the deployer module to interact and set up the environment.15# Set up the deployer module to interact and set up the environment.
17d = amulet.Deployment()16d = amulet.Deployment(series=series)
1817
19# Define the environment in terms of charms, their config, and relations.18# Define the environment in terms of charms, their config, and relations.
2019
@@ -29,7 +28,6 @@
29 d.setup(timeout=seconds)28 d.setup(timeout=seconds)
30 # Use a sentry to ensure there are no remaining hooks being execute29 # Use a sentry to ensure there are no remaining hooks being execute
31 # on any of the nodes30 # on any of the nodes
32## d.sentry.wait()
33except amulet.helpers.TimeoutError:31except amulet.helpers.TimeoutError:
34 # Pending the configuration the test will fail or be skipped32 # Pending the configuration the test will fail or be skipped
35 # if not deployed properly.33 # if not deployed properly.
@@ -40,32 +38,36 @@
40 # will automatically "FAIL" the test.38 # will automatically "FAIL" the test.
41 raise39 raise
4240
43# Access the Ubuntu instance to ensure it has been deployed correctly 41# Access the Ubuntu instance to ensure it has been deployed correctly
4442
45# Define the commands to be ran43# Define the commands to be ran
46lsb_release_command = 'cat /etc/lsb-release'44lsb_command = 'lsb_release -cs'
47uname_command = 'uname -a'45uname_command = 'uname -a'
4846
49# Cat the release information47print(lsb_command)
50output, code = d.sentry.unit['ubuntu/0'].run(lsb_release_command)48# Print the release information
51# Confirm the lsb-release command was ran successfully49output, code = d.sentry.unit['ubuntu/0'].run(lsb_command)
50print(output)
51# Confirm the lsb_release command ran successfully
52if (code != 0):52if (code != 0):
53 error_message = 'The ' + lsb_release_command + ' did not return the expected return code of 0.'53 message = 'The ' + lsb_command + ' did not return the expected return code of 0.'
54 print(output)54 amulet.raise_status(amulet.FAIL, msg=message)
55 amulet.raise_status(amulet.FAIL, msg=error_message)
56else:55else:
57 message = 'The lsb-release command successfully executed.'56 if series in output:
58 print(output)57 print('The series is correct.')
59 print(message)58 else:
59 message = 'The series is not correct.'
60 print(message)
61 amulet.raise_status(amulet.FAIL, msg=message)
6062
61# Get the uname -a output 63print(uname_command)
64# Get the uname -a output
62output, code = d.sentry.unit['ubuntu/0'].run(uname_command)65output, code = d.sentry.unit['ubuntu/0'].run(uname_command)
66print(output)
63# Confirm the uname command was ran successfully67# Confirm the uname command was ran successfully
64if (code != 0):68if (code != 0):
65 error_message = 'The ' + uname_command + ' did not return the expected return code of 0.'69 message = 'The ' + uname_command + ' did not return the expected return code of 0.'
66 print(output)70 amulet.raise_status(amulet.FAIL, msg=message)
67 amulet.raise_status(amulet.FAIL, msg=error_message)
68else:71else:
69 message = 'The uname command successfully executed.'72 message = 'The uname command successfully executed.'
70 print(output)
71 print(message)73 print(message)

Subscribers

People subscribed via source and target branches

to all changes: