Merge lp:~bigdata-dev/charms/trusty/apache-hadoop-plugin/trunk into lp:charms/trusty/apache-hadoop-plugin

Proposed by Cory Johns
Status: Merged
Merged at revision: 103
Proposed branch: lp:~bigdata-dev/charms/trusty/apache-hadoop-plugin/trunk
Merge into: lp:charms/trusty/apache-hadoop-plugin
Diff against target: 215 lines (+6/-132)
6 files modified
README.md (+1/-1)
resources.yaml (+2/-2)
tests/00-setup (+0/-8)
tests/01-basic-deployment.py (+0/-44)
tests/remote/test_dist_config.py (+0/-77)
tests/tests.yaml (+3/-0)
To merge this branch: bzr merge lp:~bigdata-dev/charms/trusty/apache-hadoop-plugin/trunk
Reviewer Review Type Date Requested Status
Kevin W Monroe Approve
Review via email: mp+273435@code.launchpad.net

Description of the change

Remove trivial test in favor of bundle tests.

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

Re-added trivial test

121. By Cory Johns

Update mailing list

122. By Cory Johns

Switch to S3 for hadoop binaries

123. By Cory Johns

Fixed relation in test

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

LGTM, +1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'README.md'
2--- README.md 2015-08-24 22:59:45 +0000
3+++ README.md 2015-10-06 18:56:18 +0000
4@@ -109,7 +109,7 @@
5
6 ## Contact Information
7
8-- <bigdata-dev@lists.launchpad.net>
9+- <bigdata@lists.ubuntu.com>
10
11
12 ## Hadoop
13
14=== modified file 'resources.yaml'
15--- resources.yaml 2015-08-17 20:35:29 +0000
16+++ resources.yaml 2015-10-06 18:56:18 +0000
17@@ -21,10 +21,10 @@
18 hash: 03ad135835bfe413f85fe176259237a8
19 hash_type: md5
20 hadoop-ppc64le:
21- url: https://git.launchpad.net/bigdata-data/plain/apache/ppc64le/hadoop-2.4.1-ppc64le.tar.gz?id=c34a21c939f5fce9ab89b95d65fe2df50e7bbab0
22+ url: https://s3.amazonaws.com/jujubigdata/apache/ppc64le/hadoop-2.4.1-ppc64le-09942b1.tar.gz
23 hash: 09942b168a3db0d183b281477d3dae9deb7b7bc4b5783ba5cda3965b62e71bd5
24 hash_type: sha256
25 hadoop-x86_64:
26- url: https://git.launchpad.net/bigdata-data/plain/apache/x86_64/hadoop-2.4.1.tar.gz?id=c34a21c939f5fce9ab89b95d65fe2df50e7bbab0
27+ url: https://s3.amazonaws.com/jujubigdata/apache/x86_64/hadoop-2.4.1-a790d39.tar.gz
28 hash: a790d39baba3a597bd226042496764e0520c2336eedb28a1a3d5c48572d3b672
29 hash_type: sha256
30
31=== added directory 'tests'
32=== removed directory 'tests'
33=== removed file 'tests/00-setup'
34--- tests/00-setup 2015-02-16 22:20:57 +0000
35+++ tests/00-setup 1970-01-01 00:00:00 +0000
36@@ -1,8 +0,0 @@
37-#!/bin/bash
38-
39-if ! dpkg -s amulet &> /dev/null; then
40- echo Installing Amulet...
41- sudo add-apt-repository -y ppa:juju/stable
42- sudo apt-get update
43- sudo apt-get -y install amulet
44-fi
45
46=== added file 'tests/01-basic-deployment.py'
47--- tests/01-basic-deployment.py 1970-01-01 00:00:00 +0000
48+++ tests/01-basic-deployment.py 2015-10-06 18:56:18 +0000
49@@ -0,0 +1,26 @@
50+#!/usr/bin/env python3
51+
52+import unittest
53+import amulet
54+
55+
56+class TestDeploy(unittest.TestCase):
57+ """
58+ Trivial deployment test for Apache Hadoop Plugin.
59+
60+ This charm cannot do anything useful by itself, so integration testing
61+ is done in the bundle.
62+ """
63+
64+ def test_deploy(self):
65+ self.d = amulet.Deployment(series='trusty')
66+ self.d.add('client', 'apache-hadoop-client')
67+ self.d.add('plugin', 'apache-hadoop-plugin')
68+ self.d.relate('client:hadoop-plugin', 'plugin:hadoop-plugin')
69+ self.d.setup(timeout=900)
70+ self.d.sentry.wait(timeout=1800)
71+ self.unit = self.d.sentry['plugin'][0]
72+
73+
74+if __name__ == '__main__':
75+ unittest.main()
76
77=== removed file 'tests/01-basic-deployment.py'
78--- tests/01-basic-deployment.py 2015-09-16 19:42:26 +0000
79+++ tests/01-basic-deployment.py 1970-01-01 00:00:00 +0000
80@@ -1,44 +0,0 @@
81-#!/usr/bin/env python3
82-
83-import unittest
84-import amulet
85-
86-
87-class TestDeploy(unittest.TestCase):
88- """
89- Basic deployment test for Apache Hadoop plugin.
90-
91- This charm cannot do anything useful by itself, so integration testing
92- is done in the bundle.
93- """
94-
95- @classmethod
96- def setUpClass(cls):
97- cls.d = amulet.Deployment(series='trusty')
98- cls.d.add('apache-hadoop-client')
99- cls.d.add('apache-hadoop-plugin')
100- cls.d.relate('apache-hadoop-client:hadoop-plugin', 'apache-hadoop-plugin:hadoop-plugin')
101- cls.d.setup(timeout=900)
102- cls.d.sentry.wait(timeout=1800)
103- # we actually care about apache-hadoop-plugin/0, but
104- # subordinates don't show up in the unit list
105- cls.unit = cls.d.sentry.unit['apache-hadoop-client/0']
106-
107- def test_deploy(self):
108- output, retcode = self.unit.run("pgrep -a java")
109- assert 'ResourceManager' not in output, "ResourceManager should not be started"
110- assert 'JobHistoryServer' not in output, "JobHistoryServer should not be started"
111- assert 'NodeManager' not in output, "NodeManager should not be started"
112- assert 'NameNode' not in output, "NameNode should not be started"
113- assert 'SecondaryNameNode' not in output, "SecondaryNameNode should not be started"
114- assert 'DataNode' not in output, "DataServer should not be started"
115-
116- def test_dist_config(self):
117- # test_dist_config.py is run on the deployed unit because it
118- # requires the Juju context to properly validate dist.yaml
119- output, retcode = self.unit.run("../../unit-apache-hadoop-plugin-0/charm/tests/remote/test_dist_config.py")
120- self.assertEqual(retcode, 0, 'Remote dist config test failed:\n{}'.format(output))
121-
122-
123-if __name__ == '__main__':
124- unittest.main()
125
126=== removed directory 'tests/remote'
127=== removed file 'tests/remote/test_dist_config.py'
128--- tests/remote/test_dist_config.py 2015-09-16 19:42:26 +0000
129+++ tests/remote/test_dist_config.py 1970-01-01 00:00:00 +0000
130@@ -1,77 +0,0 @@
131-#!/usr/bin/env python
132-
133-import grp
134-import os
135-import pwd
136-import unittest
137-
138-# activate the virtualenv
139-CHARM_DIR = os.path.join(os.path.dirname(__file__), '../..')
140-activate_this = os.path.join(CHARM_DIR, '.venv/bin/activate_this.py')
141-execfile(activate_this, dict(__file__=activate_this))
142-
143-import jujubigdata
144-
145-
146-class TestDistConfig(unittest.TestCase):
147- """
148- Test that the ``dist.yaml`` settings were applied properly, such as users, groups, and dirs.
149-
150- This is done as a remote test on the deployed unit rather than a regular
151- test under ``tests/`` because filling in the ``dist.yaml`` requires Juju
152- context (e.g., config).
153- """
154- @classmethod
155- def setUpClass(cls):
156- config = None
157- config_dir = CHARM_DIR
158- config_file = 'dist.yaml'
159- if os.path.isfile(os.path.join(config_dir, config_file)):
160- config = os.path.join(config_dir, config_file)
161- if not config:
162- raise IOError('Could not find {} in {}'.format(config_file, config_dir))
163- reqs = ['vendor', 'hadoop_version', 'packages', 'groups', 'users',
164- 'dirs']
165- cls.dist_config = jujubigdata.utils.DistConfig(config, reqs)
166-
167- def test_groups(self):
168- for name in self.dist_config.groups:
169- try:
170- grp.getgrnam(name)
171- except KeyError:
172- self.fail('Group {} is missing'.format(name))
173-
174- def test_users(self):
175- for username, details in self.dist_config.users.items():
176- try:
177- user = pwd.getpwnam(username)
178- except KeyError:
179- self.fail('User {} is missing'.format(username))
180- for groupname in details['groups']:
181- try:
182- group = grp.getgrnam(groupname)
183- except KeyError:
184- self.fail('Group {} referenced by user {} does not exist'.format(
185- groupname, username))
186- if group.gr_gid != user.pw_gid:
187- self.assertIn(username, group.gr_mem, 'User {} not in group {}'.format(
188- username, groupname))
189-
190- def test_dirs(self):
191- for name, details in self.dist_config.dirs.items():
192- dirpath = self.dist_config.path(name)
193- self.assertTrue(dirpath.isdir(), 'Dir {} is missing'.format(name))
194- stat = dirpath.stat()
195- owner = pwd.getpwuid(stat.st_uid).pw_name
196- group = grp.getgrgid(stat.st_gid).gr_name
197- perms = stat.st_mode & ~0o40000
198- self.assertEqual(owner, details.get('owner', 'root'),
199- 'Dir {} ({}) has wrong owner: {}'.format(name, dirpath, owner))
200- self.assertEqual(group, details.get('group', 'root'),
201- 'Dir {} ({}) has wrong group: {}'.format(name, dirpath, group))
202- self.assertEqual(perms, details.get('perms', 0o755),
203- 'Dir {} ({}) has wrong perms: 0o{:o}'.format(name, dirpath, perms))
204-
205-
206-if __name__ == '__main__':
207- unittest.main()
208
209=== added file 'tests/tests.yaml'
210--- tests/tests.yaml 1970-01-01 00:00:00 +0000
211+++ tests/tests.yaml 2015-10-06 18:56:18 +0000
212@@ -0,0 +1,3 @@
213+reset: false
214+packages:
215+ - amulet

Subscribers

People subscribed via source and target branches