Merge lp:~mbruzek/charms/precise/rsyslog-forwarder/add-tests into lp:charms/rsyslog-forwarder

Proposed by Matt Bruzek
Status: Merged
Merged at revision: 10
Proposed branch: lp:~mbruzek/charms/precise/rsyslog-forwarder/add-tests
Merge into: lp:charms/rsyslog-forwarder
Diff against target: 103 lines (+76/-0)
4 files modified
metadata.yaml (+2/-0)
tests/00-setup (+15/-0)
tests/10-bundles-test.py (+33/-0)
tests/bundles.yaml (+26/-0)
To merge this branch: bzr merge lp:~mbruzek/charms/precise/rsyslog-forwarder/add-tests
Reviewer Review Type Date Requested Status
José Antonio Rey (community) Approve
Review Queue (community) automated testing Needs Fixing
Review via email: mp+244051@code.launchpad.net

Description of the change

Adding tests and adding a tag to the metadata.yaml for rsyslog-forwarder

To post a comment you must log in.
11. By Matt Bruzek

Removing the autogen tests, and changing the bundle to be precise only.

Revision history for this message
Review Queue (review-queue) wrote :

This items has failed automated testing! Results available here http://reports.vapour.ws/charm-tests/charm-bundle-test-10635-results

review: Needs Fixing (automated testing)
Revision history for this message
José Antonio Rey (jose) wrote :

These tests pass with no errors at all. Thanks, Matt!

+1 LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'metadata.yaml'
2--- metadata.yaml 2012-09-11 15:54:09 +0000
3+++ metadata.yaml 2014-12-08 21:25:18 +0000
4@@ -4,6 +4,8 @@
5 summary: forwards local syslog to remote syslog server
6 description: |
7 Uses rsyslogs facilities to forward to a remote syslog server.
8+tags:
9+ - network
10 requires:
11 juju-info:
12 interface: juju-info
13
14=== added directory 'tests'
15=== added file 'tests/00-setup'
16--- tests/00-setup 1970-01-01 00:00:00 +0000
17+++ tests/00-setup 2014-12-08 21:25:18 +0000
18@@ -0,0 +1,15 @@
19+#!/bin/bash
20+
21+# This script sets up the requirements for amulet tests.
22+
23+set -x
24+
25+# Check if amulet is installed before adding the stable repository and updating apt-get.
26+dpkg -s amulet
27+if [ $? -ne 0 ]; then
28+ sudo add-apt-repository -y ppa:juju/stable
29+ sudo apt-get update -qq
30+ sudo apt-get install -y amulet
31+fi
32+
33+# Install any additional python packages or other required software.
34
35=== added file 'tests/10-bundles-test.py'
36--- tests/10-bundles-test.py 1970-01-01 00:00:00 +0000
37+++ tests/10-bundles-test.py 2014-12-08 21:25:18 +0000
38@@ -0,0 +1,33 @@
39+#!/usr/bin/env python3
40+
41+# This amulet test deploys the bundles.yaml file in this directory.
42+
43+import os
44+import unittest
45+import yaml
46+import amulet
47+
48+seconds_to_wait = 720
49+
50+
51+class BundleTest(unittest.TestCase):
52+ """ Create a class for testing the charm in the unit test framework. """
53+ @classmethod
54+ def setUpClass(cls):
55+ """ Set up an amulet deployment using the bundle. """
56+ d = amulet.Deployment()
57+ bundle_path = os.path.join(os.path.dirname(__file__), 'bundles.yaml')
58+ with open(bundle_path, 'r') as bundle_file:
59+ contents = yaml.safe_load(bundle_file)
60+ d.load(contents)
61+ d.setup(seconds_to_wait)
62+ d.sentry.wait(seconds_to_wait)
63+ cls.d = d
64+
65+ def test_deployed(self):
66+ """ Test to see if the bundle deployed successfully. """
67+ self.assertTrue(self.d.deployed)
68+
69+
70+if __name__ == '__main__':
71+ unittest.main()
72\ No newline at end of file
73
74=== added file 'tests/bundles.yaml'
75--- tests/bundles.yaml 1970-01-01 00:00:00 +0000
76+++ tests/bundles.yaml 2014-12-08 21:25:18 +0000
77@@ -0,0 +1,26 @@
78+rsyslog-forwarder-ubuntu-rsyslog:
79+ services:
80+ "rsyslog-forwarder":
81+ charm: "rsyslog-forwarder"
82+ num_units: 0
83+ annotations:
84+ "gui-x": "0"
85+ "gui-y": "0"
86+ rsyslog:
87+ charm: "cs:precise/rsyslog"
88+ num_units: 1
89+ annotations:
90+ "gui-x": "-400"
91+ "gui-y": "0"
92+ ubuntu:
93+ charm: "cs:precise/ubuntu"
94+ num_units: 1
95+ annotations:
96+ "gui-x": "0"
97+ "gui-y": "-400"
98+ relations:
99+ - - "rsyslog-forwarder:juju-info"
100+ - "ubuntu:juju-info"
101+ - - "rsyslog-forwarder:syslog"
102+ - "rsyslog:aggregator"
103+ series: precise

Subscribers

People subscribed via source and target branches

to all changes: