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

Proposed by Cory Johns
Status: Merged
Merged at revision: 70
Proposed branch: lp:~bigdata-dev/charms/trusty/apache-hadoop-hdfs-secondary/trunk
Merge into: lp:charms/trusty/apache-hadoop-hdfs-secondary
Diff against target: 204 lines (+6/-123)
6 files modified
README.md (+1/-1)
resources.yaml (+2/-2)
tests/00-setup (+0/-8)
tests/01-basic-deployment.py (+0/-40)
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-hadoop-hdfs-secondary/trunk
Reviewer Review Type Date Requested Status
Kevin W Monroe Approve
Review via email: mp+273437@code.launchpad.net

Description of the change

Remove trivial test in favor of bundle tests.

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

Re-added trivial test

84. By Cory Johns

Update mailing list

85. By Cory Johns

Switch to S3 for hadoop binaries

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-09-15 18:36:00 +0000
+++ README.md 2015-10-06 18:26:33 +0000
@@ -87,7 +87,7 @@
8787
88## Contact Information88## Contact Information
8989
90- <bigdata-dev@lists.launchpad.net>90- <bigdata@lists.ubuntu.com>
9191
9292
93## Hadoop93## Hadoop
9494
=== modified file 'resources.yaml'
--- resources.yaml 2015-09-15 18:36:00 +0000
+++ resources.yaml 2015-10-06 18:26:33 +0000
@@ -19,10 +19,10 @@
19 hash: 03ad135835bfe413f85fe176259237a819 hash: 03ad135835bfe413f85fe176259237a8
20 hash_type: md520 hash_type: md5
21 hadoop-ppc64le:21 hadoop-ppc64le:
22 url: https://git.launchpad.net/bigdata-data/plain/apache/ppc64le/hadoop-2.4.1-ppc64le.tar.gz?id=c34a21c939f5fce9ab89b95d65fe2df50e7bbab022 url: https://s3.amazonaws.com/jujubigdata/apache/ppc64le/hadoop-2.4.1-ppc64le-09942b1.tar.gz
23 hash: 09942b168a3db0d183b281477d3dae9deb7b7bc4b5783ba5cda3965b62e71bd523 hash: 09942b168a3db0d183b281477d3dae9deb7b7bc4b5783ba5cda3965b62e71bd5
24 hash_type: sha25624 hash_type: sha256
25 hadoop-x86_64:25 hadoop-x86_64:
26 url: https://git.launchpad.net/bigdata-data/plain/apache/x86_64/hadoop-2.4.1.tar.gz?id=c34a21c939f5fce9ab89b95d65fe2df50e7bbab026 url: https://s3.amazonaws.com/jujubigdata/apache/x86_64/hadoop-2.4.1-a790d39.tar.gz
27 hash: a790d39baba3a597bd226042496764e0520c2336eedb28a1a3d5c48572d3b67227 hash: a790d39baba3a597bd226042496764e0520c2336eedb28a1a3d5c48572d3b672
28 hash_type: sha25628 hash_type: sha256
2929
=== added directory 'tests'
=== removed directory 'tests'
=== removed file 'tests/00-setup'
--- tests/00-setup 2015-02-17 03:24:50 +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:26:33 +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 Hadoop HDFS Secondary.
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('secondary-namenode', 'apache-hadoop-hdfs-secondary')
18 self.d.setup(timeout=900)
19 self.d.sentry.wait(timeout=1800)
20 self.unit = self.d.sentry['secondary-namenode'][0]
21
22
23if __name__ == '__main__':
24 unittest.main()
025
=== removed file 'tests/01-basic-deployment.py'
--- tests/01-basic-deployment.py 2015-09-15 17:15:59 +0000
+++ tests/01-basic-deployment.py 1970-01-01 00:00:00 +0000
@@ -1,40 +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 SecondaryNameNode.
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-hdfs-secondary')
19 cls.d.setup(timeout=900)
20 cls.d.sentry.wait(timeout=1800)
21 cls.unit = cls.d.sentry.unit['apache-hadoop-hdfs-secondary/0']
22
23 def test_deploy(self):
24 output, retcode = self.unit.run("pgrep -a java")
25 assert 'ResourceManager' not in output, "ResourceManager should not be started"
26 assert 'JobHistoryServer' not in output, "JobHistoryServer should not be started"
27 assert 'NodeManager' not in output, "NodeManager should not be started"
28 assert 'NameNode' not in output, "NameNode should not be started"
29 assert 'SecondaryNameNode' not in output, "SecondaryNameNode should not be started"
30 assert 'DataNode' not in output, "DataServer should not be started"
31
32 def test_dist_config(self):
33 # test_dist_config.py is run on the deployed unit because it
34 # requires the Juju context to properly validate dist.yaml
35 output, retcode = self.unit.run("tests/remote/test_dist_config.py")
36 self.assertEqual(retcode, 0, 'Remote dist config test failed:\n{}'.format(output))
37
38
39if __name__ == '__main__':
40 unittest.main()
410
=== removed directory 'tests/remote'
=== removed file 'tests/remote/test_dist_config.py'
--- tests/remote/test_dist_config.py 2015-08-21 21:51:28 +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', 'ports']
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:26:33 +0000
@@ -0,0 +1,3 @@
1reset: false
2packages:
3 - amulet

Subscribers

People subscribed via source and target branches