← Back to team overview

bigdata-dev team mailing list archive

[Merge] lp:~bigdata-dev/charms/trusty/apache-hadoop-plugin/trunk into lp:charms/trusty/apache-hadoop-plugin

 

Cory Johns has proposed merging lp:~bigdata-dev/charms/trusty/apache-hadoop-plugin/trunk into lp:charms/trusty/apache-hadoop-plugin.

Requested reviews:
  charmers (charmers)

For more details, see:
https://code.launchpad.net/~bigdata-dev/charms/trusty/apache-hadoop-plugin/trunk/+merge/273435

Remove trivial test in favor of bundle tests.
-- 
Your team Juju Big Data Development is subscribed to branch lp:~bigdata-dev/charms/trusty/apache-hadoop-plugin/trunk.
=== 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 @@
-#!/bin/bash
-
-if ! dpkg -s amulet &> /dev/null; then
-    echo Installing Amulet...
-    sudo add-apt-repository -y ppa:juju/stable
-    sudo apt-get update
-    sudo apt-get -y install amulet
-fi

=== 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 @@
-#!/usr/bin/env python3
-
-import unittest
-import amulet
-
-
-class TestDeploy(unittest.TestCase):
-    """
-    Basic deployment test for Apache Hadoop plugin.
-
-    This charm cannot do anything useful by itself, so integration testing
-    is done in the bundle.
-    """
-
-    @classmethod
-    def setUpClass(cls):
-        cls.d = amulet.Deployment(series='trusty')
-        cls.d.add('apache-hadoop-client')
-        cls.d.add('apache-hadoop-plugin')
-        cls.d.relate('apache-hadoop-client:hadoop-plugin', 'apache-hadoop-plugin:hadoop-plugin')
-        cls.d.setup(timeout=900)
-        cls.d.sentry.wait(timeout=1800)
-        # we actually care about apache-hadoop-plugin/0, but
-        # subordinates don't show up in the unit list
-        cls.unit = cls.d.sentry.unit['apache-hadoop-client/0']
-
-    def test_deploy(self):
-        output, retcode = self.unit.run("pgrep -a java")
-        assert 'ResourceManager' not in output, "ResourceManager should not be started"
-        assert 'JobHistoryServer' not in output, "JobHistoryServer should not be started"
-        assert 'NodeManager' not in output, "NodeManager should not be started"
-        assert 'NameNode' not in output, "NameNode should not be started"
-        assert 'SecondaryNameNode' not in output, "SecondaryNameNode should not be started"
-        assert 'DataNode' not in output, "DataServer should not be started"
-
-    def test_dist_config(self):
-        # test_dist_config.py is run on the deployed unit because it
-        # requires the Juju context to properly validate dist.yaml
-        output, retcode = self.unit.run("../../unit-apache-hadoop-plugin-0/charm/tests/remote/test_dist_config.py")
-        self.assertEqual(retcode, 0, 'Remote dist config test failed:\n{}'.format(output))
-
-
-if __name__ == '__main__':
-    unittest.main()

=== 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 @@
-#!/usr/bin/env python
-
-import grp
-import os
-import pwd
-import unittest
-
-# activate the virtualenv
-CHARM_DIR = os.path.join(os.path.dirname(__file__), '../..')
-activate_this = os.path.join(CHARM_DIR, '.venv/bin/activate_this.py')
-execfile(activate_this, dict(__file__=activate_this))
-
-import jujubigdata
-
-
-class TestDistConfig(unittest.TestCase):
-    """
-    Test that the ``dist.yaml`` settings were applied properly, such as users, groups, and dirs.
-
-    This is done as a remote test on the deployed unit rather than a regular
-    test under ``tests/`` because filling in the ``dist.yaml`` requires Juju
-    context (e.g., config).
-    """
-    @classmethod
-    def setUpClass(cls):
-        config = None
-        config_dir = CHARM_DIR
-        config_file = 'dist.yaml'
-        if os.path.isfile(os.path.join(config_dir, config_file)):
-            config = os.path.join(config_dir, config_file)
-        if not config:
-            raise IOError('Could not find {} in {}'.format(config_file, config_dir))
-        reqs = ['vendor', 'hadoop_version', 'packages', 'groups', 'users',
-                'dirs']
-        cls.dist_config = jujubigdata.utils.DistConfig(config, reqs)
-
-    def test_groups(self):
-        for name in self.dist_config.groups:
-            try:
-                grp.getgrnam(name)
-            except KeyError:
-                self.fail('Group {} is missing'.format(name))
-
-    def test_users(self):
-        for username, details in self.dist_config.users.items():
-            try:
-                user = pwd.getpwnam(username)
-            except KeyError:
-                self.fail('User {} is missing'.format(username))
-            for groupname in details['groups']:
-                try:
-                    group = grp.getgrnam(groupname)
-                except KeyError:
-                    self.fail('Group {} referenced by user {} does not exist'.format(
-                        groupname, username))
-                if group.gr_gid != user.pw_gid:
-                    self.assertIn(username, group.gr_mem, 'User {} not in group {}'.format(
-                        username, groupname))
-
-    def test_dirs(self):
-        for name, details in self.dist_config.dirs.items():
-            dirpath = self.dist_config.path(name)
-            self.assertTrue(dirpath.isdir(), 'Dir {} is missing'.format(name))
-            stat = dirpath.stat()
-            owner = pwd.getpwuid(stat.st_uid).pw_name
-            group = grp.getgrgid(stat.st_gid).gr_name
-            perms = stat.st_mode & ~0o40000
-            self.assertEqual(owner, details.get('owner', 'root'),
-                             'Dir {} ({}) has wrong owner: {}'.format(name, dirpath, owner))
-            self.assertEqual(group, details.get('group', 'root'),
-                             'Dir {} ({}) has wrong group: {}'.format(name, dirpath, group))
-            self.assertEqual(perms, details.get('perms', 0o755),
-                             'Dir {} ({}) has wrong perms: 0o{:o}'.format(name, dirpath, perms))
-
-
-if __name__ == '__main__':
-    unittest.main()


Follow ups