Merge lp:~nicopace/charms/trusty/zookeeper/all-tests into lp:charms/trusty/zookeeper

Proposed by nicopace
Status: Merged
Merge reported by: nicopace
Merged at revision: not available
Proposed branch: lp:~nicopace/charms/trusty/zookeeper/all-tests
Merge into: lp:charms/trusty/zookeeper
Diff against target: 214 lines (+180/-1)
6 files modified
tests/00-setup (+3/-1)
tests/11-basic-test.py (+34/-0)
tests/12-change-port.py (+29/-0)
tests/13-install-source.py (+41/-0)
tests/14-scale-test.py (+40/-0)
tests/18-zookeeper-relation.py (+33/-0)
To merge this branch: bzr merge lp:~nicopace/charms/trusty/zookeeper/all-tests
Reviewer Review Type Date Requested Status
Cory Johns (community) Approve
charmers Pending
Review via email: mp+251313@code.launchpad.net

Description of the change

All zookeeper tests into one branch:
* basic test
* install source
* scale test
* change port
* zookeeper relation

To post a comment you must log in.
Revision history for this message
amir sanjar (asanjar) wrote :

good job, merging new testcases to hdp-zookeer and future apache-zookeeper, as this charm will be deprecated and removed from charmstore soon.

Revision history for this message
Cory Johns (johnsca) wrote :

Ok, the additional tests from this branch have been merged into lp:charms/trusty/hdp-zookeeper so this MP can be closed.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'tests/00-setup'
--- tests/00-setup 2014-10-29 16:21:18 +0000
+++ tests/00-setup 2015-02-27 19:03:05 +0000
@@ -13,4 +13,6 @@
13fi13fi
1414
15# Install any additional python packages or other required software.15# Install any additional python packages or other required software.
16sudo apt-get install -y python3-requests
17\ No newline at end of file16\ No newline at end of file
17sudo apt-get install -y python3-requests
18
19easy_install3 install kazoo
1820
=== added file 'tests/11-basic-test.py'
--- tests/11-basic-test.py 1970-01-01 00:00:00 +0000
+++ tests/11-basic-test.py 2015-02-27 19:03:05 +0000
@@ -0,0 +1,34 @@
1#!/usr/bin/python3
2
3import amulet
4from kazoo.client import KazooClient
5
6seconds = 20000
7
8d = amulet.Deployment(series='trusty')
9
10d.add('zookeeper')
11
12d.expose('zookeeper')
13
14try:
15 d.setup(timeout=seconds)
16except amulet.helpers.TimeoutError:
17 amulet.raise_status(amulet.SKIP, msg="Environment wasn't stood up in time")
18except:
19 raise
20
21unit = d.sentry.unit['zookeeper/0']
22
23zk = KazooClient(hosts='%s:2181' % unit.info['public_address'])
24zk.start()
25writevalue = b"a value"
26zk.create("/nodea", writevalue)
27readvalue, stat = zk.get("/nodea")
28
29if writevalue != readvalue:
30 amulet.raise_status(amulet.FAIL,
31 msg='Error in Zookeeper server,'
32 ' read different to write'
33 'write: %s, read: %s' % (writevalue, readvalue))
34zk.stop()
035
=== added file 'tests/12-change-port.py'
--- tests/12-change-port.py 1970-01-01 00:00:00 +0000
+++ tests/12-change-port.py 2015-02-27 19:03:05 +0000
@@ -0,0 +1,29 @@
1#!/usr/bin/python3
2
3import amulet
4from kazoo.client import KazooClient
5
6seconds = 20000
7
8d = amulet.Deployment(series='trusty')
9
10d.add('zookeeper')
11d.configure('zookeeper', {
12 'zk-port': 8888
13})
14
15d.expose('zookeeper')
16
17try:
18 d.setup(timeout=seconds)
19except amulet.helpers.TimeoutError:
20 amulet.raise_status(amulet.SKIP, msg="Environment wasn't stood up in time")
21except:
22 raise
23
24
25unit = d.sentry.unit['zookeeper/0']
26
27zk = KazooClient(hosts='%s:8888' % unit.info['public_address'])
28zk.start()
29zk.stop()
030
=== added file 'tests/13-install-source.py'
--- tests/13-install-source.py 1970-01-01 00:00:00 +0000
+++ tests/13-install-source.py 2015-02-27 19:03:05 +0000
@@ -0,0 +1,41 @@
1#!/usr/bin/python3
2
3import amulet
4from kazoo.client import KazooClient
5from kazoo.interfaces.IHandler import timeout_exception
6
7seconds = 20000
8
9d = amulet.Deployment(series='trusty')
10
11d.add('zookeeper')
12
13d.expose('zookeeper')
14
15try:
16 d.setup(timeout=seconds)
17except amulet.helpers.TimeoutError:
18 amulet.raise_status(amulet.SKIP, msg="Environment wasn't stood up in time")
19except:
20 raise
21
22
23sources = ['archive', 'dev', 'testing', 'stable']
24
25unit = d.sentry.unit['zookeeper/0']
26
27for source in sources:
28 d.configure('zookeeper', {
29 'source', source
30 })
31
32 d.sentry.wait()
33
34 zk = KazooClient(hosts='%s:2181' % unit.info['public_address'])
35 try:
36 zk.start()
37 zk.stop()
38 except timeout_exception:
39 amulet.raise_status(amulet.FAIL,
40 msg='Package %s doesn\'t work'
41 ' as expected' % source)
042
=== added file 'tests/14-scale-test.py'
--- tests/14-scale-test.py 1970-01-01 00:00:00 +0000
+++ tests/14-scale-test.py 2015-02-27 19:03:05 +0000
@@ -0,0 +1,40 @@
1#!/usr/bin/python3
2
3from time import sleep
4
5import amulet
6from kazoo.client import KazooClient
7
8seconds = 20000
9
10d = amulet.Deployment(series='trusty')
11
12d.add('zookeeper', units=3)
13
14d.expose('zookeeper')
15
16try:
17 d.setup(timeout=seconds)
18except amulet.helpers.TimeoutError:
19 amulet.raise_status(amulet.SKIP, msg="Environment wasn't stood up in time")
20except:
21 raise
22
23unit1 = d.sentry.unit['zookeeper/0']
24unit2 = d.sentry.unit['zookeeper/1']
25
26zk = KazooClient(hosts='%s:2181' % unit1.info['public_address'])
27zk.start()
28writevalue = b"a value"
29zk.create("/nodea", writevalue)
30zk.stop()
31
32sleep(2)
33
34zk = KazooClient(hosts='%s:2181' % unit2.info['public_address'])
35readvalue, stat = zk.get("/nodea")
36if writevalue != readvalue:
37 amulet.raise_status(amulet.FAIL,
38 msg='Error in Zookeeper server,'
39 ' read different to write'
40 'write: %s, read: %s' % (writevalue, readvalue))
041
=== added file 'tests/18-zookeeper-relation.py'
--- tests/18-zookeeper-relation.py 1970-01-01 00:00:00 +0000
+++ tests/18-zookeeper-relation.py 2015-02-27 19:03:05 +0000
@@ -0,0 +1,33 @@
1#!/usr/bin/python3
2
3import amulet
4
5seconds = 20000
6
7d = amulet.Deployment(series='trusty')
8
9d.add('zookeeper')
10d.add('kafka')
11d.relate('kafka:zk', 'zookeeper:zookeeper')
12
13try:
14 d.setup(timeout=seconds)
15except amulet.helpers.TimeoutError:
16 amulet.raise_status(amulet.SKIP, msg="Environment wasn't stood up in time")
17except:
18 raise
19
20zookeeper_unit = d.sentry.unit['zookeeper/0']
21kafka_unit = d.sentry.unit['kafka/o']
22
23create_result, create_code = kafka_unit.run(
24 "./bin/kafka-topics.sh --zookeeper 127.0.0.1:2181"
25 " --create --topic my_topic_name --partitions 5 --replication-factor 1")
26
27list_result, list_code = kafka_unit.run(
28 "./bin/kafka-topics.sh --zookeeper 127.0.0.1:2181 --list")
29
30if 'my_topic_name' not in list_result:
31 amulet.raise_status(amulet.FAIL,
32 'zookeeper relation not working properly '
33 'between zookeeper and kafka.')

Subscribers

People subscribed via source and target branches

to all changes: