Merge lp:~mbruzek/charms/precise/newrelic-php/tests into lp:~charmers/charms/precise/newrelic-php/trunk

Proposed by Matt Bruzek
Status: Merged
Merged at revision: 14
Proposed branch: lp:~mbruzek/charms/precise/newrelic-php/tests
Merge into: lp:~charmers/charms/precise/newrelic-php/trunk
Diff against target: 67 lines (+57/-0)
2 files modified
tests/00-setup (+5/-0)
tests/99-autogen (+52/-0)
To merge this branch: bzr merge lp:~mbruzek/charms/precise/newrelic-php/tests
Reviewer Review Type Date Requested Status
Charles Butler (community) Approve
Antonio Rosales (community) community Approve
Review Queue (community) automated testing Needs Fixing
Review via email: mp+240983@code.launchpad.net

Commit message

Adding tests for this charm

To post a comment you must log in.
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-10628-results

review: Needs Fixing (automated testing)
15. By Matt Bruzek

Adding newrelic key to test.

Revision history for this message
Matt Bruzek (mbruzek) wrote :

After adding the key the tests passed bundletester on my local machine.

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-10829-results

review: Needs Fixing (automated testing)
Revision history for this message
Antonio Rosales (arosales) wrote :

As this merge proposal only add charm tests and does not touch charm code I would like to suggest to accept this merge proposal even though the charm is failing the tests for the following reasons:

1. A test is still valid even if the results aren't positive.
2. Having charm tests provides the first step to helping the charm author and community fix the charm. Specifically by providing a reproducible failure.
3. The tests are seed (basic) tests that an interested person can build off of.
4. As fixes are made to this charm automating charm testing will be able to run additional tests in addition to charm proof.
5. Having basic tests, as demonstrated here, helps ensure the charm is in a working (deployable) state given this charm is a recommended charm. A test failure can prompt a bug the charm author can take action on. The charm author may not have been aware of the bug had the charm not had even basic deployment tests.

In this case the test does deploy a valid thinkup environment, and @mbruzek also added a key to ensure the setup was not an issue in the tests. However, automated testing is showing that relation between newrelic and wordpress is failing. The test correctly deploys the environment, but the relation needs fixing which is the intent of the tests.

Thus, for the above reason I would suggest to accept this merge to add in tests.

+1 LGTM

review: Approve (community)
Revision history for this message
Antonio Rosales (arosales) wrote :
Revision history for this message
Charles Butler (lazypower) wrote :

Confirmed that the test failure is due to the charm code and not the test. I'm going to approve this as is with the hope that a maintainer will step into fixing the

unit-newrelic-php-0[19254]: 2015-01-09 21:03:28 INFO unit.newrelic-php/0.start logger.go:40 newrelic-php5: unrecognized service

Thanks for your contributions mbruzek and jose!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'tests'
2=== added file 'tests/00-setup'
3--- tests/00-setup 1970-01-01 00:00:00 +0000
4+++ tests/00-setup 2014-12-19 22:08:38 +0000
5@@ -0,0 +1,5 @@
6+#!/bin/bash
7+
8+sudo add-apt-repository ppa:juju/stable -y
9+sudo apt-get update
10+sudo apt-get install amulet python3-requests -y
11
12=== added file 'tests/99-autogen'
13--- tests/99-autogen 1970-01-01 00:00:00 +0000
14+++ tests/99-autogen 2014-12-19 22:08:38 +0000
15@@ -0,0 +1,52 @@
16+#!/usr/bin/env python3
17+
18+import amulet
19+import requests
20+import unittest
21+
22+
23+class TestDeployment(unittest.TestCase):
24+ @classmethod
25+ def setUpClass(cls):
26+ cls.deployment = amulet.Deployment(series='precise')
27+
28+ cls.deployment.add('newrelic-php')
29+ cls.deployment.add('wordpress')
30+ cls.deployment.configure('newrelic-php', {'key': '2e2b4406be1e34fe64b228ca7dc16d4ce555add5'})
31+ cls.deployment.relate('newrelic-php:juju-info', 'wordpress:juju-info')
32+
33+ try:
34+ cls.deployment.setup(timeout=900)
35+ cls.deployment.sentry.wait()
36+ except amulet.helpers.TimeoutError:
37+ amulet.raise_status(amulet.SKIP, msg="Environment wasn't stood up in time")
38+ except:
39+ raise
40+
41+ def test_case(self):
42+ # Now you can use self.deployment.sentry.unit[UNIT] to address each of
43+ # the units and perform more in-depth steps. You can also reference
44+ # the first unit as self.unit.
45+ # There are three test statuses that can be triggered with
46+ # amulet.raise_status():
47+ # - amulet.PASS
48+ # - amulet.FAIL
49+ # - amulet.SKIP
50+ # Each unit has the following methods:
51+ # - .info - An array of the information of that unit from Juju
52+ # - .file(PATH) - Get the details of a file on that unit
53+ # - .file_contents(PATH) - Get plain text output of PATH file from that unit
54+ # - .directory(PATH) - Get details of directory
55+ # - .directory_contents(PATH) - List files and folders in PATH on that unit
56+ # - .relation(relation, service:rel) - Get relation data from return service
57+ # add tests here to confirm service is up and working properly
58+ # For example, to confirm that it has a functioning HTTP server:
59+ # page = requests.get('http://{}'.format(self.unit.info['public-address']))
60+ # page.raise_for_status()
61+ # More information on writing Amulet tests can be found at:
62+ # https://juju.ubuntu.com/docs/tools-amulet.html
63+ pass
64+
65+
66+if __name__ == '__main__':
67+ unittest.main()

Subscribers

People subscribed via source and target branches

to all changes: