Merge lp:~bigdata-dev/charms/bundles/apache-core-batch-processing/trunk into lp:~charmers/charms/bundles/apache-core-batch-processing/bundle

Proposed by Cory Johns
Status: Merged
Merged at revision: 19
Proposed branch: lp:~bigdata-dev/charms/bundles/apache-core-batch-processing/trunk
Merge into: lp:~charmers/charms/bundles/apache-core-batch-processing/bundle
Diff against target: 182 lines (+41/-88)
2 files modified
tests/00-setup (+1/-1)
tests/01-bundle.py (+40/-87)
To merge this branch: bzr merge lp:~bigdata-dev/charms/bundles/apache-core-batch-processing/trunk
Reviewer Review Type Date Requested Status
Tim Van Steenburgh (community) Approve
Review via email: mp+273285@code.launchpad.net

Description of the change

Tests for CWR

To post a comment you must log in.
Revision history for this message
Tim Van Steenburgh (tvansteenburgh) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/00-setup'
2--- tests/00-setup 2015-09-15 14:34:39 +0000
3+++ tests/00-setup 2015-10-02 20:28:11 +0000
4@@ -14,5 +14,5 @@
5
6 if [[ -n "$to_install" ]]; then
7 echo Installing $to_install...
8- sudo apt-get install $to_install
9+ sudo apt-get install -y $to_install
10 fi
11
12=== modified file 'tests/01-bundle.py'
13--- tests/01-bundle.py 2015-09-15 16:54:53 +0000
14+++ tests/01-bundle.py 2015-10-02 20:28:11 +0000
15@@ -1,22 +1,17 @@
16 #!/usr/bin/env python3
17
18 import os
19-import time
20 import unittest
21
22 import yaml
23 import amulet
24
25
26-class Base(object):
27- """
28- Base class for tests for Apache Hadoop Bundle.
29- """
30+class TestBundle(unittest.TestCase):
31 bundle_file = os.path.join(os.path.dirname(__file__), '..', 'bundle.yaml')
32- profile_name = None
33
34 @classmethod
35- def deploy(cls):
36+ def setUpClass(cls):
37 # classmethod inheritance doesn't work quite right with
38 # setUpClass / tearDownClass, so subclasses have to manually call this
39 cls.d = amulet.Deployment(series='trusty')
40@@ -24,35 +19,15 @@
41 bun = f.read()
42 bundle = yaml.safe_load(bun)
43 cls.d.load(bundle)
44- cls.d.setup(timeout=9000)
45- cls.d.sentry.wait()
46- cls.hdfs = cls.d.sentry.unit['hdfs-master/0']
47- cls.yarn = cls.d.sentry.unit['yarn-master/0']
48- cls.slave = cls.d.sentry.unit['compute-slave/0']
49- cls.secondary = cls.d.sentry.unit['secondary-namenode/0']
50- cls.client = cls.d.sentry.unit['client/0']
51-
52- @classmethod
53- def reset_env(cls):
54- # classmethod inheritance doesn't work quite right with
55- # setUpClass / tearDownClass, so subclasses have to manually call this
56- juju_env = amulet.helpers.default_environment()
57- services = ['hdfs-master', 'yarn-master', 'compute-slave', 'secondary-namenode', 'plugin', 'client']
58-
59- def check_env_clear():
60- state = amulet.waiter.state(juju_env=juju_env)
61- for service in services:
62- if state.get(service, {}) != {}:
63- return False
64- return True
65-
66- for service in services:
67- cls.d.remove(service)
68- with amulet.helpers.timeout(300):
69- while not check_env_clear():
70- time.sleep(5)
71-
72- def test_hadoop_components(self):
73+ cls.d.setup(timeout=1800)
74+ cls.d.sentry.wait_for_messages({'plugin': 'Ready'}, timeout=1800)
75+ cls.hdfs = cls.d.sentry['hdfs-master'][0]
76+ cls.yarn = cls.d.sentry['yarn-master'][0]
77+ cls.slave = cls.d.sentry['compute-slave'][0]
78+ cls.secondary = cls.d.sentry['secondary-namenode'][0]
79+ cls.client = cls.d.sentry['client'][0]
80+
81+ def test_components(self):
82 """
83 Confirm that all of the required components are up and running.
84 """
85@@ -64,13 +39,40 @@
86
87 # .NameNode needs the . to differentiate it from SecondaryNameNode
88 assert '.NameNode' in hdfs, "NameNode not started"
89+ assert '.NameNode' not in yarn, "NameNode should not be running on yarn-master"
90+ assert '.NameNode' not in slave, "NameNode should not be running on compute-slave"
91+ assert '.NameNode' not in secondary, "NameNode should not be running on secondary-namenode"
92+ assert '.NameNode' not in client, "NameNode should not be running on client"
93+
94 assert 'ResourceManager' in yarn, "ResourceManager not started"
95+ assert 'ResourceManager' not in hdfs, "ResourceManager should not be running on hdfs-master"
96+ assert 'ResourceManager' not in slave, "ResourceManager should not be running on compute-slave"
97+ assert 'ResourceManager' not in secondary, "ResourceManager should not be running on secondary-namenode"
98+ assert 'ResourceManager' not in client, "ResourceManager should not be running on client"
99+
100 assert 'JobHistoryServer' in yarn, "JobHistoryServer not started"
101+ assert 'JobHistoryServer' not in hdfs, "JobHistoryServer should not be running on hdfs-master"
102+ assert 'JobHistoryServer' not in slave, "JobHistoryServer should not be running on compute-slave"
103+ assert 'JobHistoryServer' not in secondary, "JobHistoryServer should not be running on secondary-namenode"
104+ assert 'JobHistoryServer' not in client, "JobHistoryServer should not be running on client"
105+
106 assert 'NodeManager' in slave, "NodeManager not started"
107+ assert 'NodeManager' not in yarn, "NodeManager should not be running on yarn-master"
108+ assert 'NodeManager' not in hdfs, "NodeManager should not be running on hdfs-master"
109+ assert 'NodeManager' not in secondary, "NodeManager should not be running on secondary-namenode"
110+ assert 'NodeManager' not in client, "NodeManager should not be running on client"
111+
112 assert 'DataNode' in slave, "DataServer not started"
113+ assert 'DataNode' not in yarn, "DataNode should not be running on yarn-master"
114+ assert 'DataNode' not in hdfs, "DataNode should not be running on hdfs-master"
115+ assert 'DataNode' not in secondary, "DataNode should not be running on secondary-namenode"
116+ assert 'DataNode' not in client, "DataNode should not be running on client"
117+
118 assert 'SecondaryNameNode' in secondary, "SecondaryNameNode not started"
119-
120- return hdfs, yarn, slave, secondary, client # allow subclasses to do additional checks
121+ assert 'SecondaryNameNode' not in yarn, "SecondaryNameNode should not be running on yarn-master"
122+ assert 'SecondaryNameNode' not in hdfs, "SecondaryNameNode should not be running on hdfs-master"
123+ assert 'SecondaryNameNode' not in slave, "SecondaryNameNode should not be running on compute-slave"
124+ assert 'SecondaryNameNode' not in client, "SecondaryNameNode should not be running on client"
125
126 def test_hdfs_dir(self):
127 """
128@@ -113,54 +115,5 @@
129 assert retcode == 0, "{} FAILED:\n{}".format(name, output)
130
131
132-class TestScalable(unittest.TestCase, Base):
133- @classmethod
134- def setUpClass(cls):
135- cls.deploy()
136-
137- @classmethod
138- def tearDownClass(cls):
139- cls.reset_env()
140-
141- def test_hadoop_components(self):
142- """
143- In addition to testing that the components are running where they
144- are supposed to be, confirm that none of them are also running where
145- they shouldn't be.
146- """
147- hdfs, yarn, slave, secondary, client = super(TestScalable, self).test_hadoop_components()
148-
149- # .NameNode needs the . to differentiate it from SecondaryNameNode
150- assert '.NameNode' not in yarn, "NameNode should not be running on yarn-master"
151- assert '.NameNode' not in slave, "NameNode should not be running on compute-slave"
152- assert '.NameNode' not in secondary, "NameNode should not be running on secondary-namenode"
153- assert '.NameNode' not in client, "NameNode should not be running on client"
154-
155- assert 'ResourceManager' not in hdfs, "ResourceManager should not be running on hdfs-master"
156- assert 'ResourceManager' not in slave, "ResourceManager should not be running on compute-slave"
157- assert 'ResourceManager' not in secondary, "ResourceManager should not be running on secondary-namenode"
158- assert 'ResourceManager' not in client, "ResourceManager should not be running on client"
159-
160- assert 'JobHistoryServer' not in hdfs, "JobHistoryServer should not be running on hdfs-master"
161- assert 'JobHistoryServer' not in slave, "JobHistoryServer should not be running on compute-slave"
162- assert 'JobHistoryServer' not in secondary, "JobHistoryServer should not be running on secondary-namenode"
163- assert 'JobHistoryServer' not in client, "JobHistoryServer should not be running on client"
164-
165- assert 'NodeManager' not in yarn, "NodeManager should not be running on yarn-master"
166- assert 'NodeManager' not in hdfs, "NodeManager should not be running on hdfs-master"
167- assert 'NodeManager' not in secondary, "NodeManager should not be running on secondary-namenode"
168- assert 'NodeManager' not in client, "NodeManager should not be running on client"
169-
170- assert 'DataNode' not in yarn, "DataNode should not be running on yarn-master"
171- assert 'DataNode' not in hdfs, "DataNode should not be running on hdfs-master"
172- assert 'DataNode' not in secondary, "DataNode should not be running on secondary-namenode"
173- assert 'DataNode' not in client, "DataNode should not be running on client"
174-
175- assert 'SecondaryNameNode' not in yarn, "SecondaryNameNode should not be running on yarn-master"
176- assert 'SecondaryNameNode' not in hdfs, "SecondaryNameNode should not be running on hdfs-master"
177- assert 'SecondaryNameNode' not in slave, "SecondaryNameNode should not be running on compute-slave"
178- assert 'SecondaryNameNode' not in client, "SecondaryNameNode should not be running on client"
179-
180-
181 if __name__ == '__main__':
182 unittest.main()

Subscribers

People subscribed via source and target branches