Merge lp:~marcoceppi/charms/precise/seafile/tests into lp:charms/seafile

Proposed by Marco Ceppi on 2014-11-06
Status: Merged
Merged at revision: 9
Proposed branch: lp:~marcoceppi/charms/precise/seafile/tests
Merge into: lp:charms/seafile
Diff against target: 68 lines (+58/-0)
2 files modified
tests/00-setup (+5/-0)
tests/99-autogen (+53/-0)
To merge this branch: bzr merge lp:~marcoceppi/charms/precise/seafile/tests
Reviewer Review Type Date Requested Status
Charles Butler (community) Approve on 2015-02-10
Juan L. Negron (community) 2014-11-06 Approve on 2015-01-08
Antonio Rosales (community) community Approve on 2015-01-08
Review Queue (community) automated testing Needs Fixing on 2014-12-09
Review via email: mp+240964@code.launchpad.net

Commit Message

Tests for charm

To post a comment you must log in.
Review Queue (review-queue) wrote :

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

review: Needs Fixing (automated testing)
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.

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

+1 LGTM

review: Approve (community)
Juan L. Negron (negronjl) wrote :

I agree with Antonio's reasoning for this.

+1 from me as well.

-Juan

review: Approve
José Antonio Rey (jose) wrote :

Bare in mind that if the queue follows its natural flow, the fix for seafile should arrive before the tests, so nothing to worry about here.

Charles Butler (lazypower) wrote :

Landing this with respect to Antonio's case made above, and our agenda with moving unkept charms to the ~unmaintained branch - this test serves as a baseline for that work and the activeness on the charm should keep it from moving abruptly.

Thank you for your attention to detail and hard work to ensure we have quality charms in the store.

+1

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-11-06 20:09:55 +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-11-06 20:09:55 +0000
15@@ -0,0 +1,53 @@
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('seafile')
29+ cls.deployment.add('haproxy')
30+ cls.deployment.add('memcached')
31+ cls.deployment.relate('seafile:website', 'haproxy:reverseproxy')
32+ cls.deployment.relate('seafile:cache', 'memcached:cache')
33+
34+ try:
35+ cls.deployment.setup(timeout=900)
36+ cls.deployment.sentry.wait()
37+ except amulet.helpers.TimeoutError:
38+ amulet.raise_status(amulet.SKIP, msg="Environment wasn't stood up in time")
39+ except:
40+ raise
41+
42+ def test_case(self):
43+ # Now you can use self.deployment.sentry.unit[UNIT] to address each of
44+ # the units and perform more in-depth steps. You can also reference
45+ # the first unit as self.unit.
46+ # There are three test statuses that can be triggered with
47+ # amulet.raise_status():
48+ # - amulet.PASS
49+ # - amulet.FAIL
50+ # - amulet.SKIP
51+ # Each unit has the following methods:
52+ # - .info - An array of the information of that unit from Juju
53+ # - .file(PATH) - Get the details of a file on that unit
54+ # - .file_contents(PATH) - Get plain text output of PATH file from that unit
55+ # - .directory(PATH) - Get details of directory
56+ # - .directory_contents(PATH) - List files and folders in PATH on that unit
57+ # - .relation(relation, service:rel) - Get relation data from return service
58+ # add tests here to confirm service is up and working properly
59+ # For example, to confirm that it has a functioning HTTP server:
60+ # page = requests.get('http://{}'.format(self.unit.info['public-address']))
61+ # page.raise_for_status()
62+ # More information on writing Amulet tests can be found at:
63+ # https://juju.ubuntu.com/docs/tools-amulet.html
64+ pass
65+
66+
67+if __name__ == '__main__':
68+ unittest.main()

Subscribers

People subscribed via source and target branches

to all changes: