Merge lp:~bigdata-dev/charms/trusty/apache-hadoop-hdfs-master/smoke-test into lp:~bigdata-dev/charms/trusty/apache-hadoop-hdfs-master/trunk

Proposed by Cory Johns
Status: Merged
Merged at revision: 98
Proposed branch: lp:~bigdata-dev/charms/trusty/apache-hadoop-hdfs-master/smoke-test
Merge into: lp:~bigdata-dev/charms/trusty/apache-hadoop-hdfs-master/trunk
Diff against target: 107 lines (+84/-0)
3 files modified
README.md (+29/-0)
actions.yaml (+2/-0)
actions/smoke-test (+53/-0)
To merge this branch: bzr merge lp:~bigdata-dev/charms/trusty/apache-hadoop-hdfs-master/smoke-test
Reviewer Review Type Date Requested Status
Kevin W Monroe Approve
Review via email: mp+268263@code.launchpad.net

Description of the change

Added smoke-test action and relevant README section

To post a comment you must log in.
Revision history for this message
Kevin W Monroe (kwmonroe) wrote :

I really like this, but want confirmation that the action should bail out if a datanode isn't connected, which is to say that it won't be possible for charm.active to be True without a DN. Is that right?

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

LGTM after confirming previous comment; only beef here was a need to +x actions/smoke-test, but this has now been merged to ./trunk.

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-08-07 21:30:37 +0000
+++ README.md 2015-08-17 18:17:22 +0000
@@ -27,6 +27,35 @@
27 hadoop jar my-job.jar27 hadoop jar my-job.jar
2828
2929
30## Status and Smoke Test
31
32The services provide extended status reporting to indicate when they are ready:
33
34 juju status --format=tabular
35
36This is particularly useful when combined with `watch` to track the on-going
37progress of the deployment:
38
39 watch -n 0.5 juju status --format=tabular
40
41The message for each unit will provide information about that unit's state.
42Once they all indicate that they are ready, you can perform a "smoke test"
43to verify that HDFS is working as expected using the built-in `smoke-test`
44action:
45
46 juju action do smoke-test
47
48After a few seconds or so, you can check the results of the smoke test:
49
50 juju action status
51
52You will see `status: completed` if the smoke test was successful, or
53`status: failed` if it was not. You can get more information on why it failed
54via:
55
56 juju action fetch <action-id>
57
58
30## Deploying in Network-Restricted Environments59## Deploying in Network-Restricted Environments
3160
32The Apache Hadoop charms can be deployed in environments with limited network61The Apache Hadoop charms can be deployed in environments with limited network
3362
=== modified file 'actions.yaml'
--- actions.yaml 2015-06-23 17:15:23 +0000
+++ actions.yaml 2015-08-17 18:17:22 +0000
@@ -4,3 +4,5 @@
4 description: All of the HDFS processes can be stopped with this Juju action.4 description: All of the HDFS processes can be stopped with this Juju action.
5restart-hdfs:5restart-hdfs:
6 description: All of the HDFS processes can be restarted with this Juju action.6 description: All of the HDFS processes can be restarted with this Juju action.
7smoke-test:
8 description: Verify that HDFS is working by creating and removing a small file.
79
=== added file 'actions/smoke-test'
--- actions/smoke-test 1970-01-01 00:00:00 +0000
+++ actions/smoke-test 2015-08-17 18:17:22 +0000
@@ -0,0 +1,53 @@
1#!/usr/bin/env python
2
3import sys
4
5try:
6 from charmhelpers.core import hookenv
7 from charmhelpers.core import unitdata
8 from jujubigdata.utils import run_as
9 charm_ready = unitdata.kv().get('charm.active', False)
10except ImportError:
11 charm_ready = False
12
13if not charm_ready:
14 # might not have hookenv.action_fail available yet
15 from subprocess import call
16 call(['action-fail', 'HDFS service not yet ready'])
17
18
19# verify the hdfs-test directory does not already exist
20output = run_as('ubuntu', 'hdfs', 'dfs', '-ls', '/tmp', capture_output=True)
21if '/tmp/hdfs-test' in output:
22 run_as('ubuntu', 'hdfs', 'dfs', '-rm', '-R', '/tmp/hdfs-test')
23 output = run_as('ubuntu', 'hdfs', 'dfs', '-ls', '/tmp', capture_output=True)
24 if 'hdfs-test' in output:
25 hookenv.action_fail('Unable to remove existing hdfs-test directory')
26 sys.exit()
27
28# create the directory
29run_as('ubuntu', 'hdfs', 'dfs', '-mkdir', '-p', '/tmp/hdfs-test')
30run_as('ubuntu', 'hdfs', 'dfs', '-chmod', '-R', '777', '/tmp/hdfs-test')
31
32# verify the newly created hdfs-test subdirectory exists
33output = run_as('ubuntu', 'hdfs', 'dfs', '-ls', '/tmp', capture_output=True)
34for line in output.split('\n'):
35 if '/tmp/hdfs-test' in line:
36 if 'ubuntu' not in line or 'drwxrwxrwx' not in line:
37 hookenv.action_fail('Permissions incorrect for hdfs-test directory')
38 sys.exit()
39 break
40else:
41 hookenv.action_fail('Unable to create hdfs-test directory')
42 sys.exit()
43
44# remove the directory
45run_as('ubuntu', 'hdfs', 'dfs', '-rm', '-R', '/tmp/hdfs-test')
46
47# verify the hdfs-test subdirectory has been removed
48output = run_as('ubuntu', 'hdfs', 'dfs', '-ls', '/tmp', capture_output=True)
49if '/tmp/hdfs-test' in output:
50 hookenv.action_fail('Unable to remove hdfs-test directory')
51 sys.exit()
52
53hookenv.action_set({'outcome': 'success'})

Subscribers

People subscribed via source and target branches

to all changes: