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
=== modified file 'README.md'
--- README.md 2015-08-24 22:59:45 +0000
+++ README.md 2015-10-06 18:56:18 +0000
@@ -109,7 +109,7 @@
109109
110## Contact Information110## Contact Information
111111
112- <bigdata-dev@lists.launchpad.net>112- <bigdata@lists.ubuntu.com>
113113
114114
115## Hadoop115## Hadoop
116116
=== modified file 'resources.yaml'
--- resources.yaml 2015-08-17 20:35:29 +0000
+++ resources.yaml 2015-10-06 18:56:18 +0000
@@ -21,10 +21,10 @@
21 hash: 03ad135835bfe413f85fe176259237a821 hash: 03ad135835bfe413f85fe176259237a8
22 hash_type: md522 hash_type: md5
23 hadoop-ppc64le:23 hadoop-ppc64le:
24 url: https://git.launchpad.net/bigdata-data/plain/apache/ppc64le/hadoop-2.4.1-ppc64le.tar.gz?id=c34a21c939f5fce9ab89b95d65fe2df50e7bbab024 url: https://s3.amazonaws.com/jujubigdata/apache/ppc64le/hadoop-2.4.1-ppc64le-09942b1.tar.gz
25 hash: 09942b168a3db0d183b281477d3dae9deb7b7bc4b5783ba5cda3965b62e71bd525 hash: 09942b168a3db0d183b281477d3dae9deb7b7bc4b5783ba5cda3965b62e71bd5
26 hash_type: sha25626 hash_type: sha256
27 hadoop-x86_64:27 hadoop-x86_64:
28 url: https://git.launchpad.net/bigdata-data/plain/apache/x86_64/hadoop-2.4.1.tar.gz?id=c34a21c939f5fce9ab89b95d65fe2df50e7bbab028 url: https://s3.amazonaws.com/jujubigdata/apache/x86_64/hadoop-2.4.1-a790d39.tar.gz
29 hash: a790d39baba3a597bd226042496764e0520c2336eedb28a1a3d5c48572d3b67229 hash: a790d39baba3a597bd226042496764e0520c2336eedb28a1a3d5c48572d3b672
30 hash_type: sha25630 hash_type: sha256
3131
=== added directory 'tests'
=== removed directory 'tests'
=== removed file 'tests/00-setup'
--- tests/00-setup 2015-02-16 22:20:57 +0000
+++ tests/00-setup 1970-01-01 00:00:00 +0000
@@ -1,8 +0,0 @@
1#!/bin/bash
2
3if ! dpkg -s amulet &> /dev/null; then
4 echo Installing Amulet...
5 sudo add-apt-repository -y ppa:juju/stable
6 sudo apt-get update
7 sudo apt-get -y install amulet
8fi
90
=== 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:56:18 +0000
@@ -0,0 +1,26 @@
1#!/usr/bin/env python3
2
3import unittest
4import amulet
5
6
7class TestDeploy(unittest.TestCase):
8 """
9 Trivial deployment test for Apache Hadoop Plugin.
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('client', 'apache-hadoop-client')
18 self.d.add('plugin', 'apache-hadoop-plugin')
19 self.d.relate('client:hadoop-plugin', 'plugin:hadoop-plugin')
20 self.d.setup(timeout=900)
21 self.d.sentry.wait(timeout=1800)
22 self.unit = self.d.sentry['plugin'][0]
23
24
25if __name__ == '__main__':
26 unittest.main()
027
=== removed file 'tests/01-basic-deployment.py'
--- tests/01-basic-deployment.py 2015-09-16 19:42:26 +0000
+++ tests/01-basic-deployment.py 1970-01-01 00:00:00 +0000
@@ -1,44 +0,0 @@
1#!/usr/bin/env python3
2
3import unittest
4import amulet
5
6
7class TestDeploy(unittest.TestCase):
8 """
9 Basic deployment test for Apache Hadoop plugin.
10
11 This charm cannot do anything useful by itself, so integration testing
12 is done in the bundle.
13 """
14
15 @classmethod
16 def setUpClass(cls):
17 cls.d = amulet.Deployment(series='trusty')
18 cls.d.add('apache-hadoop-client')
19 cls.d.add('apache-hadoop-plugin')
20 cls.d.relate('apache-hadoop-client:hadoop-plugin', 'apache-hadoop-plugin:hadoop-plugin')
21 cls.d.setup(timeout=900)
22 cls.d.sentry.wait(timeout=1800)
23 # we actually care about apache-hadoop-plugin/0, but
24 # subordinates don't show up in the unit list
25 cls.unit = cls.d.sentry.unit['apache-hadoop-client/0']
26
27 def test_deploy(self):
28 output, retcode = self.unit.run("pgrep -a java")
29 assert 'ResourceManager' not in output, "ResourceManager should not be started"
30 assert 'JobHistoryServer' not in output, "JobHistoryServer should not be started"
31 assert 'NodeManager' not in output, "NodeManager should not be started"
32 assert 'NameNode' not in output, "NameNode should not be started"
33 assert 'SecondaryNameNode' not in output, "SecondaryNameNode should not be started"
34 assert 'DataNode' not in output, "DataServer should not be started"
35
36 def test_dist_config(self):
37 # test_dist_config.py is run on the deployed unit because it
38 # requires the Juju context to properly validate dist.yaml
39 output, retcode = self.unit.run("../../unit-apache-hadoop-plugin-0/charm/tests/remote/test_dist_config.py")
40 self.assertEqual(retcode, 0, 'Remote dist config test failed:\n{}'.format(output))
41
42
43if __name__ == '__main__':
44 unittest.main()
450
=== removed directory 'tests/remote'
=== removed file 'tests/remote/test_dist_config.py'
--- tests/remote/test_dist_config.py 2015-09-16 19:42:26 +0000
+++ tests/remote/test_dist_config.py 1970-01-01 00:00:00 +0000
@@ -1,77 +0,0 @@
1#!/usr/bin/env python
2
3import grp
4import os
5import pwd
6import unittest
7
8# activate the virtualenv
9CHARM_DIR = os.path.join(os.path.dirname(__file__), '../..')
10activate_this = os.path.join(CHARM_DIR, '.venv/bin/activate_this.py')
11execfile(activate_this, dict(__file__=activate_this))
12
13import jujubigdata
14
15
16class TestDistConfig(unittest.TestCase):
17 """
18 Test that the ``dist.yaml`` settings were applied properly, such as users, groups, and dirs.
19
20 This is done as a remote test on the deployed unit rather than a regular
21 test under ``tests/`` because filling in the ``dist.yaml`` requires Juju
22 context (e.g., config).
23 """
24 @classmethod
25 def setUpClass(cls):
26 config = None
27 config_dir = CHARM_DIR
28 config_file = 'dist.yaml'
29 if os.path.isfile(os.path.join(config_dir, config_file)):
30 config = os.path.join(config_dir, config_file)
31 if not config:
32 raise IOError('Could not find {} in {}'.format(config_file, config_dir))
33 reqs = ['vendor', 'hadoop_version', 'packages', 'groups', 'users',
34 'dirs']
35 cls.dist_config = jujubigdata.utils.DistConfig(config, reqs)
36
37 def test_groups(self):
38 for name in self.dist_config.groups:
39 try:
40 grp.getgrnam(name)
41 except KeyError:
42 self.fail('Group {} is missing'.format(name))
43
44 def test_users(self):
45 for username, details in self.dist_config.users.items():
46 try:
47 user = pwd.getpwnam(username)
48 except KeyError:
49 self.fail('User {} is missing'.format(username))
50 for groupname in details['groups']:
51 try:
52 group = grp.getgrnam(groupname)
53 except KeyError:
54 self.fail('Group {} referenced by user {} does not exist'.format(
55 groupname, username))
56 if group.gr_gid != user.pw_gid:
57 self.assertIn(username, group.gr_mem, 'User {} not in group {}'.format(
58 username, groupname))
59
60 def test_dirs(self):
61 for name, details in self.dist_config.dirs.items():
62 dirpath = self.dist_config.path(name)
63 self.assertTrue(dirpath.isdir(), 'Dir {} is missing'.format(name))
64 stat = dirpath.stat()
65 owner = pwd.getpwuid(stat.st_uid).pw_name
66 group = grp.getgrgid(stat.st_gid).gr_name
67 perms = stat.st_mode & ~0o40000
68 self.assertEqual(owner, details.get('owner', 'root'),
69 'Dir {} ({}) has wrong owner: {}'.format(name, dirpath, owner))
70 self.assertEqual(group, details.get('group', 'root'),
71 'Dir {} ({}) has wrong group: {}'.format(name, dirpath, group))
72 self.assertEqual(perms, details.get('perms', 0o755),
73 'Dir {} ({}) has wrong perms: 0o{:o}'.format(name, dirpath, perms))
74
75
76if __name__ == '__main__':
77 unittest.main()
780
=== added file 'tests/tests.yaml'
--- tests/tests.yaml 1970-01-01 00:00:00 +0000
+++ tests/tests.yaml 2015-10-06 18:56:18 +0000
@@ -0,0 +1,3 @@
1reset: false
2packages:
3 - amulet

Subscribers

People subscribed via source and target branches