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
1=== modified file 'tests/00-setup.sh'
2--- tests/00-setup.sh 2014-01-25 03:15:50 +0000
3+++ tests/00-setup.sh 2015-02-19 18:14:52 +0000
4@@ -1,7 +1,15 @@
5-#!/bin/sh
6-
7-# Install Amulet testing harness as it is not on the
8-# default cloud image. Amulet should pull in its dependencies.
9-sudo add-apt-repository -y ppa:juju/stable
10-sudo apt-get update
11-sudo apt-get install -y amulet
12+#!/bin/bash
13+
14+# This script runs first to set up the environment for the tests.
15+
16+set -x
17+
18+# Check if amulet is installed before adding repository and updating apt-get.
19+dpkg -s amulet
20+if [ $? -ne 0 ]; then
21+ sudo add-apt-repository -y ppa:juju/stable
22+ sudo apt-get update -qq
23+ sudo apt-get install -y amulet
24+fi
25+# Install any additional packages needed for tests here.
26+
27
28=== modified file 'tests/10-deploy-test.py'
29--- tests/10-deploy-test.py 2014-01-25 03:15:50 +0000
30+++ tests/10-deploy-test.py 2015-02-19 18:14:52 +0000
31@@ -3,18 +3,17 @@
32 # This Amulet based tests
33 # The goal is to ensure the Ubuntu charm
34 # sucessfully deploys and can be accessed.
35-# Note the Ubuntu charm does not have any
36+# Note the Ubuntu charm does not have any
37 # relations or config options.
38
39 import amulet
40-#import os
41-#import requests
42
43 # Timeout value, in seconds to deploy the environment
44 seconds = 900
45+series = 'trusty'
46
47 # Set up the deployer module to interact and set up the environment.
48-d = amulet.Deployment()
49+d = amulet.Deployment(series=series)
50
51 # Define the environment in terms of charms, their config, and relations.
52
53@@ -29,7 +28,6 @@
54 d.setup(timeout=seconds)
55 # Use a sentry to ensure there are no remaining hooks being execute
56 # on any of the nodes
57-## d.sentry.wait()
58 except amulet.helpers.TimeoutError:
59 # Pending the configuration the test will fail or be skipped
60 # if not deployed properly.
61@@ -40,32 +38,36 @@
62 # will automatically "FAIL" the test.
63 raise
64
65-# Access the Ubuntu instance to ensure it has been deployed correctly
66+# Access the Ubuntu instance to ensure it has been deployed correctly
67
68 # Define the commands to be ran
69-lsb_release_command = 'cat /etc/lsb-release'
70+lsb_command = 'lsb_release -cs'
71 uname_command = 'uname -a'
72
73-# Cat the release information
74-output, code = d.sentry.unit['ubuntu/0'].run(lsb_release_command)
75-# Confirm the lsb-release command was ran successfully
76+print(lsb_command)
77+# Print the release information
78+output, code = d.sentry.unit['ubuntu/0'].run(lsb_command)
79+print(output)
80+# Confirm the lsb_release command ran successfully
81 if (code != 0):
82- error_message = 'The ' + lsb_release_command + ' did not return the expected return code of 0.'
83- print(output)
84- amulet.raise_status(amulet.FAIL, msg=error_message)
85+ message = 'The ' + lsb_command + ' did not return the expected return code of 0.'
86+ amulet.raise_status(amulet.FAIL, msg=message)
87 else:
88- message = 'The lsb-release command successfully executed.'
89- print(output)
90- print(message)
91+ if series in output:
92+ print('The series is correct.')
93+ else:
94+ message = 'The series is not correct.'
95+ print(message)
96+ amulet.raise_status(amulet.FAIL, msg=message)
97
98-# Get the uname -a output
99+print(uname_command)
100+# Get the uname -a output
101 output, code = d.sentry.unit['ubuntu/0'].run(uname_command)
102+print(output)
103 # Confirm the uname command was ran successfully
104 if (code != 0):
105- error_message = 'The ' + uname_command + ' did not return the expected return code of 0.'
106- print(output)
107- amulet.raise_status(amulet.FAIL, msg=error_message)
108+ message = 'The ' + uname_command + ' did not return the expected return code of 0.'
109+ amulet.raise_status(amulet.FAIL, msg=message)
110 else:
111 message = 'The uname command successfully executed.'
112- print(output)
113 print(message)

Subscribers

People subscribed via source and target branches

to all changes: