Merge lp:~bigdata-dev/charms/bundles/apache-hadoop-spark-zeppelin/trunk into lp:~charmers/charms/bundles/apache-hadoop-spark-zeppelin/bundle

Proposed by Cory Johns
Status: Merged
Merged at revision: 7
Proposed branch: lp:~bigdata-dev/charms/bundles/apache-hadoop-spark-zeppelin/trunk
Merge into: lp:~charmers/charms/bundles/apache-hadoop-spark-zeppelin/bundle
Diff against target: 270 lines (+146/-15)
5 files modified
README.md (+1/-1)
bundle-local.yaml (+7/-7)
bundle.yaml (+7/-7)
tests/01-bundle.py (+128/-0)
tests/tests.yaml (+3/-0)
To merge this branch: bzr merge lp:~bigdata-dev/charms/bundles/apache-hadoop-spark-zeppelin/trunk
Reviewer Review Type Date Requested Status
Kevin W Monroe Approve
Review via email: mp+273284@code.launchpad.net

Description of the change

Tests for CWR

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

Added tests.yaml and removed no longer needed 00-setup

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

LGTM, +1

review: Approve
11. By Cory Johns

Updated to latest charm revisions

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-06-26 17:43:25 +0000
3+++ README.md 2015-10-07 21:34:35 +0000
4@@ -15,7 +15,7 @@
5 ## Usage
6 Deploy this bundle using juju-quickstart:
7
8- juju quickstart u/bigdata-dev/apache-hadoop-spark-zeppelin
9+ juju quickstart apache-hadoop-spark-zeppelin
10
11 See `juju quickstart --help` for deployment options, including machine
12 constraints and how to deploy a locally modified version of the
13
14=== modified file 'bundle-local.yaml'
15--- bundle-local.yaml 2015-09-17 13:16:26 +0000
16+++ bundle-local.yaml 2015-10-07 21:34:35 +0000
17@@ -1,46 +1,46 @@
18 services:
19 compute-slave:
20- charm: trusty/apache-hadoop-compute-slave
21+ charm: apache-hadoop-compute-slave
22 num_units: 3
23 annotations:
24 gui-x: "300"
25 gui-y: "200"
26 constraints: mem=3G
27 hdfs-master:
28- charm: trusty/apache-hadoop-hdfs-master
29+ charm: apache-hadoop-hdfs-master
30 num_units: 1
31 annotations:
32 gui-x: "600"
33 gui-y: "350"
34 constraints: mem=7G
35 plugin:
36- charm: trusty/apache-hadoop-plugin
37+ charm: apache-hadoop-plugin
38 annotations:
39 gui-x: "900"
40 gui-y: "200"
41 secondary-namenode:
42- charm: trusty/apache-hadoop-hdfs-secondary
43+ charm: apache-hadoop-hdfs-secondary
44 num_units: 1
45 annotations:
46 gui-x: "600"
47 gui-y: "600"
48 constraints: mem=7G
49 spark:
50- charm: trusty/apache-spark
51+ charm: apache-spark
52 num_units: 1
53 annotations:
54 gui-x: "1200"
55 gui-y: "200"
56 constraints: mem=3G
57 yarn-master:
58- charm: trusty/apache-hadoop-yarn-master
59+ charm: apache-hadoop-yarn-master
60 num_units: 1
61 annotations:
62 gui-x: "600"
63 gui-y: "100"
64 constraints: mem=7G
65 zeppelin:
66- charm: trusty/apache-zeppelin
67+ charm: apache-zeppelin
68 annotations:
69 gui-x: "1200"
70 gui-y: "450"
71
72=== modified file 'bundle.yaml'
73--- bundle.yaml 2015-09-17 13:16:26 +0000
74+++ bundle.yaml 2015-10-07 21:34:35 +0000
75@@ -1,46 +1,46 @@
76 services:
77 compute-slave:
78- charm: cs:trusty/apache-hadoop-compute-slave-8
79+ charm: cs:trusty/apache-hadoop-compute-slave-9
80 num_units: 3
81 annotations:
82 gui-x: "300"
83 gui-y: "200"
84 constraints: mem=3G
85 hdfs-master:
86- charm: cs:trusty/apache-hadoop-hdfs-master-8
87+ charm: cs:trusty/apache-hadoop-hdfs-master-9
88 num_units: 1
89 annotations:
90 gui-x: "600"
91 gui-y: "350"
92 constraints: mem=7G
93 plugin:
94- charm: cs:trusty/apache-hadoop-plugin-7
95+ charm: cs:trusty/apache-hadoop-plugin-8
96 annotations:
97 gui-x: "900"
98 gui-y: "200"
99 secondary-namenode:
100- charm: cs:trusty/apache-hadoop-hdfs-secondary-6
101+ charm: cs:trusty/apache-hadoop-hdfs-secondary-7
102 num_units: 1
103 annotations:
104 gui-x: "600"
105 gui-y: "600"
106 constraints: mem=7G
107 spark:
108- charm: cs:trusty/apache-spark-3
109+ charm: cs:trusty/apache-spark-4
110 num_units: 1
111 annotations:
112 gui-x: "1200"
113 gui-y: "200"
114 constraints: mem=3G
115 yarn-master:
116- charm: cs:trusty/apache-hadoop-yarn-master-6
117+ charm: cs:trusty/apache-hadoop-yarn-master-7
118 num_units: 1
119 annotations:
120 gui-x: "600"
121 gui-y: "100"
122 constraints: mem=7G
123 zeppelin:
124- charm: cs:trusty/apache-zeppelin-3
125+ charm: cs:trusty/apache-zeppelin-5
126 annotations:
127 gui-x: "1200"
128 gui-y: "450"
129
130=== added directory 'tests'
131=== added file 'tests/01-bundle.py'
132--- tests/01-bundle.py 1970-01-01 00:00:00 +0000
133+++ tests/01-bundle.py 2015-10-07 21:34:35 +0000
134@@ -0,0 +1,128 @@
135+#!/usr/bin/env python3
136+
137+import os
138+import unittest
139+
140+import yaml
141+import amulet
142+
143+
144+class TestBundle(unittest.TestCase):
145+ bundle_file = os.path.join(os.path.dirname(__file__), '..', 'bundle.yaml')
146+
147+ @classmethod
148+ def setUpClass(cls):
149+ cls.d = amulet.Deployment(series='trusty')
150+ with open(cls.bundle_file) as f:
151+ bun = f.read()
152+ bundle = yaml.safe_load(bun)
153+ cls.d.load(bundle)
154+ cls.d.setup(timeout=1800)
155+ cls.d.sentry.wait_for_messages({'zeppelin': 'Ready'}, timeout=1800)
156+ cls.hdfs = cls.d.sentry['hdfs-master'][0]
157+ cls.yarn = cls.d.sentry['yarn-master'][0]
158+ cls.slave = cls.d.sentry['compute-slave'][0]
159+ cls.secondary = cls.d.sentry['secondary-namenode'][0]
160+ cls.spark = cls.d.sentry['spark'][0]
161+ cls.zeppelin = cls.d.sentry['zeppelin'][0]
162+
163+ def test_components(self):
164+ """
165+ Confirm that all of the required components are up and running.
166+ """
167+ hdfs, retcode = self.hdfs.run("pgrep -a java")
168+ yarn, retcode = self.yarn.run("pgrep -a java")
169+ slave, retcode = self.slave.run("pgrep -a java")
170+ secondary, retcode = self.secondary.run("pgrep -a java")
171+ spark, retcode = self.spark.run("pgrep -a java")
172+
173+ # .NameNode needs the . to differentiate it from SecondaryNameNode
174+ assert '.NameNode' in hdfs, "NameNode not started"
175+ assert '.NameNode' not in yarn, "NameNode should not be running on yarn-master"
176+ assert '.NameNode' not in slave, "NameNode should not be running on compute-slave"
177+ assert '.NameNode' not in secondary, "NameNode should not be running on secondary-namenode"
178+ assert '.NameNode' not in spark, "NameNode should not be running on spark"
179+
180+ assert 'ResourceManager' in yarn, "ResourceManager not started"
181+ assert 'ResourceManager' not in hdfs, "ResourceManager should not be running on hdfs-master"
182+ assert 'ResourceManager' not in slave, "ResourceManager should not be running on compute-slave"
183+ assert 'ResourceManager' not in secondary, "ResourceManager should not be running on secondary-namenode"
184+ assert 'ResourceManager' not in spark, "ResourceManager should not be running on spark"
185+
186+ assert 'JobHistoryServer' in yarn, "JobHistoryServer not started"
187+ assert 'JobHistoryServer' not in hdfs, "JobHistoryServer should not be running on hdfs-master"
188+ assert 'JobHistoryServer' not in slave, "JobHistoryServer should not be running on compute-slave"
189+ assert 'JobHistoryServer' not in secondary, "JobHistoryServer should not be running on secondary-namenode"
190+ assert 'JobHistoryServer' not in spark, "JobHistoryServer should not be running on spark"
191+
192+ assert 'NodeManager' in slave, "NodeManager not started"
193+ assert 'NodeManager' not in yarn, "NodeManager should not be running on yarn-master"
194+ assert 'NodeManager' not in hdfs, "NodeManager should not be running on hdfs-master"
195+ assert 'NodeManager' not in secondary, "NodeManager should not be running on secondary-namenode"
196+ assert 'NodeManager' not in spark, "NodeManager should not be running on spark"
197+
198+ assert 'DataNode' in slave, "DataServer not started"
199+ assert 'DataNode' not in yarn, "DataNode should not be running on yarn-master"
200+ assert 'DataNode' not in hdfs, "DataNode should not be running on hdfs-master"
201+ assert 'DataNode' not in secondary, "DataNode should not be running on secondary-namenode"
202+ assert 'DataNode' not in spark, "DataNode should not be running on spark"
203+
204+ assert 'SecondaryNameNode' in secondary, "SecondaryNameNode not started"
205+ assert 'SecondaryNameNode' not in yarn, "SecondaryNameNode should not be running on yarn-master"
206+ assert 'SecondaryNameNode' not in hdfs, "SecondaryNameNode should not be running on hdfs-master"
207+ assert 'SecondaryNameNode' not in slave, "SecondaryNameNode should not be running on compute-slave"
208+ assert 'SecondaryNameNode' not in spark, "SecondaryNameNode should not be running on spark"
209+
210+ assert 'spark' in spark, 'Spark should be running on spark'
211+ assert 'zeppelin' in spark, 'Zeppelin should be running on spark'
212+
213+ def test_hdfs_dir(self):
214+ """
215+ Validate admin few hadoop activities on HDFS cluster.
216+ 1) This test validates mkdir on hdfs cluster
217+ 2) This test validates change hdfs dir owner on the cluster
218+ 3) This test validates setting hdfs directory access permission on the cluster
219+
220+ NB: These are order-dependent, so must be done as part of a single test case.
221+ """
222+ output, retcode = self.spark.run("su hdfs -c 'hdfs dfs -mkdir -p /user/ubuntu'")
223+ assert retcode == 0, "Created a user directory on hdfs FAILED:\n{}".format(output)
224+ output, retcode = self.spark.run("su hdfs -c 'hdfs dfs -chown ubuntu:ubuntu /user/ubuntu'")
225+ assert retcode == 0, "Assigning an owner to hdfs directory FAILED:\n{}".format(output)
226+ output, retcode = self.spark.run("su hdfs -c 'hdfs dfs -chmod -R 755 /user/ubuntu'")
227+ assert retcode == 0, "seting directory permission on hdfs FAILED:\n{}".format(output)
228+
229+ def test_yarn_mapreduce_exe(self):
230+ """
231+ Validate yarn mapreduce operations:
232+ 1) validate mapreduce execution - writing to hdfs
233+ 2) validate successful mapreduce operation after the execution
234+ 3) validate mapreduce execution - reading and writing to hdfs
235+ 4) validate successful mapreduce operation after the execution
236+ 5) validate successful deletion of mapreduce operation result from hdfs
237+
238+ NB: These are order-dependent, so must be done as part of a single test case.
239+ """
240+ jar_file = '/usr/lib/hadoop/share/hadoop/mapreduce/hadoop-mapreduce-examples-*.jar'
241+ test_steps = [
242+ ('teragen', "su ubuntu -c 'hadoop jar {} teragen 10000 /user/ubuntu/teragenout'".format(jar_file)),
243+ ('mapreduce #1', "su hdfs -c 'hdfs dfs -ls /user/ubuntu/teragenout/_SUCCESS'"),
244+ ('terasort', "su ubuntu -c 'hadoop jar {} terasort /user/ubuntu/teragenout /user/ubuntu/terasortout'".
245+ format(jar_file)),
246+ ('mapreduce #2', "su hdfs -c 'hdfs dfs -ls /user/ubuntu/terasortout/_SUCCESS'"),
247+ ('cleanup', "su hdfs -c 'hdfs dfs -rm -r /user/ubuntu/teragenout'"),
248+ ]
249+ for name, step in test_steps:
250+ output, retcode = self.spark.run(step)
251+ assert retcode == 0, "{} FAILED:\n{}".format(name, output)
252+
253+ def test_spark(self):
254+ output, retcode = self.spark.run("su ubuntu -c 'bash -lc /home/ubuntu/sparkpi.sh 2>&1'")
255+ assert 'Pi is roughly' in output, 'SparkPI test failed: %s' % output
256+
257+ def test_zeppelin(self):
258+ pass # requires javascript; how to test?
259+
260+
261+if __name__ == '__main__':
262+ unittest.main()
263
264=== added file 'tests/tests.yaml'
265--- tests/tests.yaml 1970-01-01 00:00:00 +0000
266+++ tests/tests.yaml 2015-10-07 21:34:35 +0000
267@@ -0,0 +1,3 @@
268+reset: false
269+packages:
270+ - amulet

Subscribers

People subscribed via source and target branches