bigdata-dev team mailing list archive
-
bigdata-dev team
-
Mailing list archive
-
Message #00340
[Merge] lp:~bigdata-dev/charms/bundles/apache-core-batch-processing/trunk into lp:~charmers/charms/bundles/apache-core-batch-processing/bundle
Cory Johns has proposed merging lp:~bigdata-dev/charms/bundles/apache-core-batch-processing/trunk into lp:~charmers/charms/bundles/apache-core-batch-processing/bundle.
Requested reviews:
charmers (charmers)
For more details, see:
https://code.launchpad.net/~bigdata-dev/charms/bundles/apache-core-batch-processing/trunk/+merge/273285
Tests for CWR
--
Your team Juju Big Data Development is subscribed to branch lp:~bigdata-dev/charms/bundles/apache-core-batch-processing/trunk.
=== modified file 'tests/01-bundle.py'
--- tests/01-bundle.py 2015-09-15 16:54:53 +0000
+++ tests/01-bundle.py 2015-10-02 19:27:43 +0000
@@ -1,22 +1,17 @@
#!/usr/bin/env python3
import os
-import time
import unittest
import yaml
import amulet
-class Base(object):
- """
- Base class for tests for Apache Hadoop Bundle.
- """
+class TestBundle(unittest.TestCase):
bundle_file = os.path.join(os.path.dirname(__file__), '..', 'bundle.yaml')
- profile_name = None
@classmethod
- def deploy(cls):
+ def setUpClass(cls):
# classmethod inheritance doesn't work quite right with
# setUpClass / tearDownClass, so subclasses have to manually call this
cls.d = amulet.Deployment(series='trusty')
@@ -24,35 +19,15 @@
bun = f.read()
bundle = yaml.safe_load(bun)
cls.d.load(bundle)
- cls.d.setup(timeout=9000)
- cls.d.sentry.wait()
- cls.hdfs = cls.d.sentry.unit['hdfs-master/0']
- cls.yarn = cls.d.sentry.unit['yarn-master/0']
- cls.slave = cls.d.sentry.unit['compute-slave/0']
- cls.secondary = cls.d.sentry.unit['secondary-namenode/0']
- cls.client = cls.d.sentry.unit['client/0']
-
- @classmethod
- def reset_env(cls):
- # classmethod inheritance doesn't work quite right with
- # setUpClass / tearDownClass, so subclasses have to manually call this
- juju_env = amulet.helpers.default_environment()
- services = ['hdfs-master', 'yarn-master', 'compute-slave', 'secondary-namenode', 'plugin', 'client']
-
- def check_env_clear():
- state = amulet.waiter.state(juju_env=juju_env)
- for service in services:
- if state.get(service, {}) != {}:
- return False
- return True
-
- for service in services:
- cls.d.remove(service)
- with amulet.helpers.timeout(300):
- while not check_env_clear():
- time.sleep(5)
-
- def test_hadoop_components(self):
+ cls.d.setup(timeout=1800)
+ cls.d.sentry.wait_for_messages({'plugin': 'Ready'}, timeout=1800)
+ cls.hdfs = cls.d.sentry['hdfs-master'][0]
+ cls.yarn = cls.d.sentry['yarn-master'][0]
+ cls.slave = cls.d.sentry['compute-slave'][0]
+ cls.secondary = cls.d.sentry['secondary-namenode'][0]
+ cls.client = cls.d.sentry['client'][0]
+
+ def test_components(self):
"""
Confirm that all of the required components are up and running.
"""
@@ -64,13 +39,40 @@
# .NameNode needs the . to differentiate it from SecondaryNameNode
assert '.NameNode' in hdfs, "NameNode not started"
+ assert '.NameNode' not in yarn, "NameNode should not be running on yarn-master"
+ assert '.NameNode' not in slave, "NameNode should not be running on compute-slave"
+ assert '.NameNode' not in secondary, "NameNode should not be running on secondary-namenode"
+ assert '.NameNode' not in client, "NameNode should not be running on client"
+
assert 'ResourceManager' in yarn, "ResourceManager not started"
+ assert 'ResourceManager' not in hdfs, "ResourceManager should not be running on hdfs-master"
+ assert 'ResourceManager' not in slave, "ResourceManager should not be running on compute-slave"
+ assert 'ResourceManager' not in secondary, "ResourceManager should not be running on secondary-namenode"
+ assert 'ResourceManager' not in client, "ResourceManager should not be running on client"
+
assert 'JobHistoryServer' in yarn, "JobHistoryServer not started"
+ assert 'JobHistoryServer' not in hdfs, "JobHistoryServer should not be running on hdfs-master"
+ assert 'JobHistoryServer' not in slave, "JobHistoryServer should not be running on compute-slave"
+ assert 'JobHistoryServer' not in secondary, "JobHistoryServer should not be running on secondary-namenode"
+ assert 'JobHistoryServer' not in client, "JobHistoryServer should not be running on client"
+
assert 'NodeManager' in slave, "NodeManager not started"
+ assert 'NodeManager' not in yarn, "NodeManager should not be running on yarn-master"
+ assert 'NodeManager' not in hdfs, "NodeManager should not be running on hdfs-master"
+ assert 'NodeManager' not in secondary, "NodeManager should not be running on secondary-namenode"
+ assert 'NodeManager' not in client, "NodeManager should not be running on client"
+
assert 'DataNode' in slave, "DataServer not started"
+ assert 'DataNode' not in yarn, "DataNode should not be running on yarn-master"
+ assert 'DataNode' not in hdfs, "DataNode should not be running on hdfs-master"
+ assert 'DataNode' not in secondary, "DataNode should not be running on secondary-namenode"
+ assert 'DataNode' not in client, "DataNode should not be running on client"
+
assert 'SecondaryNameNode' in secondary, "SecondaryNameNode not started"
-
- return hdfs, yarn, slave, secondary, client # allow subclasses to do additional checks
+ assert 'SecondaryNameNode' not in yarn, "SecondaryNameNode should not be running on yarn-master"
+ assert 'SecondaryNameNode' not in hdfs, "SecondaryNameNode should not be running on hdfs-master"
+ assert 'SecondaryNameNode' not in slave, "SecondaryNameNode should not be running on compute-slave"
+ assert 'SecondaryNameNode' not in client, "SecondaryNameNode should not be running on client"
def test_hdfs_dir(self):
"""
@@ -113,54 +115,5 @@
assert retcode == 0, "{} FAILED:\n{}".format(name, output)
-class TestScalable(unittest.TestCase, Base):
- @classmethod
- def setUpClass(cls):
- cls.deploy()
-
- @classmethod
- def tearDownClass(cls):
- cls.reset_env()
-
- def test_hadoop_components(self):
- """
- In addition to testing that the components are running where they
- are supposed to be, confirm that none of them are also running where
- they shouldn't be.
- """
- hdfs, yarn, slave, secondary, client = super(TestScalable, self).test_hadoop_components()
-
- # .NameNode needs the . to differentiate it from SecondaryNameNode
- assert '.NameNode' not in yarn, "NameNode should not be running on yarn-master"
- assert '.NameNode' not in slave, "NameNode should not be running on compute-slave"
- assert '.NameNode' not in secondary, "NameNode should not be running on secondary-namenode"
- assert '.NameNode' not in client, "NameNode should not be running on client"
-
- assert 'ResourceManager' not in hdfs, "ResourceManager should not be running on hdfs-master"
- assert 'ResourceManager' not in slave, "ResourceManager should not be running on compute-slave"
- assert 'ResourceManager' not in secondary, "ResourceManager should not be running on secondary-namenode"
- assert 'ResourceManager' not in client, "ResourceManager should not be running on client"
-
- assert 'JobHistoryServer' not in hdfs, "JobHistoryServer should not be running on hdfs-master"
- assert 'JobHistoryServer' not in slave, "JobHistoryServer should not be running on compute-slave"
- assert 'JobHistoryServer' not in secondary, "JobHistoryServer should not be running on secondary-namenode"
- assert 'JobHistoryServer' not in client, "JobHistoryServer should not be running on client"
-
- assert 'NodeManager' not in yarn, "NodeManager should not be running on yarn-master"
- assert 'NodeManager' not in hdfs, "NodeManager should not be running on hdfs-master"
- assert 'NodeManager' not in secondary, "NodeManager should not be running on secondary-namenode"
- assert 'NodeManager' not in client, "NodeManager should not be running on client"
-
- assert 'DataNode' not in yarn, "DataNode should not be running on yarn-master"
- assert 'DataNode' not in hdfs, "DataNode should not be running on hdfs-master"
- assert 'DataNode' not in secondary, "DataNode should not be running on secondary-namenode"
- assert 'DataNode' not in client, "DataNode should not be running on client"
-
- assert 'SecondaryNameNode' not in yarn, "SecondaryNameNode should not be running on yarn-master"
- assert 'SecondaryNameNode' not in hdfs, "SecondaryNameNode should not be running on hdfs-master"
- assert 'SecondaryNameNode' not in slave, "SecondaryNameNode should not be running on compute-slave"
- assert 'SecondaryNameNode' not in client, "SecondaryNameNode should not be running on client"
-
-
if __name__ == '__main__':
unittest.main()
Follow ups