Merge lp:~bigdata-dev/charms/trusty/apache-flume-syslog/trunk into lp:charms/trusty/apache-flume-syslog

Proposed by Cory Johns
Status: Merged
Merged at revision: 4
Proposed branch: lp:~bigdata-dev/charms/trusty/apache-flume-syslog/trunk
Merge into: lp:charms/trusty/apache-flume-syslog
Diff against target: 173 lines (+31/-81)
7 files modified
README.md (+1/-1)
hooks/callbacks.py (+2/-2)
resources.yaml (+1/-1)
tests/00-setup (+0/-5)
tests/01-basic-deployment.py (+24/-0)
tests/remote/test_dist_config.py (+0/-72)
tests/tests.yaml (+3/-0)
To merge this branch: bzr merge lp:~bigdata-dev/charms/trusty/apache-flume-syslog/trunk
Reviewer Review Type Date Requested Status
Kevin W Monroe Approve
Review via email: mp+273428@code.launchpad.net

Description of the change

Remove trivial test in favor of bundle tests.

To post a comment you must log in.
18. By Cory Johns

Re-added trivial test

19. By Cory Johns

Switch to S3 for flume binaries

20. By Cory Johns

Update mailing list

Revision history for this message
Kevin W Monroe (kwmonroe) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'README.md'
--- README.md 2015-08-25 06:00:05 +0000
+++ README.md 2015-10-06 18:18:59 +0000
@@ -88,7 +88,7 @@
8888
89## Contact Information89## Contact Information
9090
91- <bigdata-dev@lists.launchpad.net>91- <bigdata@lists.ubuntu.com>
9292
9393
94## Help94## Help
9595
=== modified file 'hooks/callbacks.py'
--- hooks/callbacks.py 2015-09-10 04:24:51 +0000
+++ hooks/callbacks.py 2015-10-06 18:18:59 +0000
@@ -53,7 +53,7 @@
53 self.verify_resources = utils.verify_resources(*self.resources.values())53 self.verify_resources = utils.verify_resources(*self.resources.values())
5454
55 def is_installed(self):55 def is_installed(self):
56 return unitdata.kv().get('flume.installed')56 return unitdata.kv().get('flume_syslog.installed')
5757
58 def install(self, force=False):58 def install(self, force=False):
59 if not force and self.is_installed():59 if not force and self.is_installed():
@@ -66,7 +66,7 @@
66 self.dist_config.add_packages()66 self.dist_config.add_packages()
67 self.setup_flume_config()67 self.setup_flume_config()
68 self.configure_flume()68 self.configure_flume()
69 unitdata.kv().set('flume.installed', True)69 unitdata.kv().set('flume_syslog.installed', True)
7070
71 def setup_flume_config(self):71 def setup_flume_config(self):
72 '''72 '''
7373
=== modified file 'resources.yaml'
--- resources.yaml 2015-08-25 06:00:05 +0000
+++ resources.yaml 2015-10-06 18:18:59 +0000
@@ -7,6 +7,6 @@
7 pypi: jujubigdata>=4.0.0,<5.0.07 pypi: jujubigdata>=4.0.0,<5.0.0
8optional_resources:8optional_resources:
9 flume-x86_64:9 flume-x86_64:
10 url: https://git.launchpad.net/bigdata-data/plain/apache/x86_64/apache-flume-1.6.0-bin.tar.gz?id=c34a21c939f5fce9ab89b95d65fe2df50e7bbab010 url: https://s3.amazonaws.com/jujubigdata/apache/x86_64/apache-flume-1.6.0-bin-defd21a.tar.gz
11 hash: defd21ad8d2b6f28cc0a16b96f65209911 hash: defd21ad8d2b6f28cc0a16b96f652099
12 hash_type: md512 hash_type: md5
1313
=== added directory 'tests'
=== removed directory 'tests'
=== removed file 'tests/00-setup'
--- tests/00-setup 2015-06-18 22:40:46 +0000
+++ tests/00-setup 1970-01-01 00:00:00 +0000
@@ -1,5 +0,0 @@
1#!/bin/bash
2
3sudo add-apt-repository ppa:juju/stable -y
4sudo apt-get update
5sudo apt-get install python3 amulet -y
60
=== added file 'tests/01-basic-deployment.py'
--- tests/01-basic-deployment.py 1970-01-01 00:00:00 +0000
+++ tests/01-basic-deployment.py 2015-10-06 18:18:59 +0000
@@ -0,0 +1,24 @@
1#!/usr/bin/env python3
2
3import unittest
4import amulet
5
6
7class TestDeploy(unittest.TestCase):
8 """
9 Trivial deployment test for Apache Flume / Syslog.
10
11 This charm cannot do anything useful by itself, so integration testing
12 is done in the bundle.
13 """
14
15 def test_deploy(self):
16 self.d = amulet.Deployment(series='trusty')
17 self.d.add('flume-syslog', 'apache-flume-syslog')
18 self.d.setup(timeout=900)
19 self.d.sentry.wait(timeout=1800)
20 self.unit = self.d.sentry['flume-syslog'][0]
21
22
23if __name__ == '__main__':
24 unittest.main()
025
=== removed directory 'tests/remote'
=== removed file 'tests/remote/test_dist_config.py'
--- tests/remote/test_dist_config.py 2015-08-25 06:00:05 +0000
+++ tests/remote/test_dist_config.py 1970-01-01 00:00:00 +0000
@@ -1,72 +0,0 @@
1#!/usr/bin/env python
2
3import grp
4import os
5import pwd
6import unittest
7
8from charmhelpers.contrib import bigdata
9
10
11class TestDistConfig(unittest.TestCase):
12 """
13 Test that the ``dist.yaml`` settings were applied properly, such as users, groups, and dirs.
14
15 This is done as a remote test on the deployed unit rather than a regular
16 test under ``tests/`` because filling in the ``dist.yaml`` requires Juju
17 context (e.g., config).
18 """
19 @classmethod
20 def setUpClass(cls):
21 config = None
22 config_dir = os.environ['JUJU_CHARM_DIR']
23 config_file = 'dist.yaml'
24 if os.path.isfile(os.path.join(config_dir, config_file)):
25 config = os.path.join(config_dir, config_file)
26 if not config:
27 raise IOError('Could not find {} in {}'.format(config_file, config_dir))
28 reqs = ['vendor', 'hadoop_version', 'packages', 'groups', 'users',
29 'dirs']
30 cls.dist_config = bigdata.utils.DistConfig(config, reqs)
31
32 def test_groups(self):
33 for name in self.dist_config.groups:
34 try:
35 grp.getgrnam(name)
36 except KeyError:
37 self.fail('Group {} is missing'.format(name))
38
39 def test_users(self):
40 for username, details in self.dist_config.users.items():
41 try:
42 user = pwd.getpwnam(username)
43 except KeyError:
44 self.fail('User {} is missing'.format(username))
45 for groupname in details['groups']:
46 try:
47 group = grp.getgrnam(groupname)
48 except KeyError:
49 self.fail('Group {} referenced by user {} does not exist'.format(
50 groupname, username))
51 if group.gr_gid != user.pw_gid:
52 self.assertIn(username, group.gr_mem, 'User {} not in group {}'.format(
53 username, groupname))
54
55 def test_dirs(self):
56 for name, details in self.dist_config.dirs.items():
57 dirpath = self.dist_config.path(name)
58 self.assertTrue(dirpath.isdir(), 'Dir {} is missing'.format(name))
59 stat = dirpath.stat()
60 owner = pwd.getpwuid(stat.st_uid).pw_name
61 group = grp.getgrgid(stat.st_gid).gr_name
62 perms = stat.st_mode & ~0o40000
63 self.assertEqual(owner, details.get('owner', 'root'),
64 'Dir {} ({}) has wrong owner: {}'.format(name, dirpath, owner))
65 self.assertEqual(group, details.get('group', 'root'),
66 'Dir {} ({}) has wrong group: {}'.format(name, dirpath, group))
67 self.assertEqual(perms, details.get('perms', 0o755),
68 'Dir {} ({}) has wrong perms: 0o{:o}'.format(name, dirpath, perms))
69
70
71if __name__ == '__main__':
72 unittest.main()
730
=== added file 'tests/tests.yaml'
--- tests/tests.yaml 1970-01-01 00:00:00 +0000
+++ tests/tests.yaml 2015-10-06 18:18:59 +0000
@@ -0,0 +1,3 @@
1reset: false
2packages:
3 - amulet

Subscribers

People subscribed via source and target branches