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

Proposed by nicopace
Status: Merged
Merged at revision: 15
Proposed branch: lp:~nicopace/charms/trusty/kibana/all-tests
Merge into: lp:charms/trusty/kibana
Diff against target: 129 lines (+120/-0)
2 files modified
tests/11-scale-elastic-query.json (+49/-0)
tests/11-scale-elastic.py (+71/-0)
To merge this branch: bzr merge lp:~nicopace/charms/trusty/kibana/all-tests
Reviewer Review Type Date Requested Status
amir sanjar (community) Needs Fixing
charmers Pending
Review via email: mp+251309@code.launchpad.net

Description of the change

Merged kibana tests in one merge:
* basic test
* scale elastic

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

2015-03-03 12:30:51 Starting deployment of local
2015-03-03 12:30:54 Deploying services...
2015-03-03 12:30:54 Deploying service elasticsearch using cs:trusty/elasticsearch-8
2015-03-03 12:31:03 Deploying service logstash-indexer using cs:precise/logstash-indexer-4
Traceback (most recent call last):
  File "/usr/bin/juju-deployer", line 9, in <module>
    load_entry_point('juju-deployer==0.4.3', 'console_scripts', 'juju-deployer')()
  File "/usr/lib/python2.7/dist-packages/deployer/cli.py", line 130, in main
    run()
  File "/usr/lib/python2.7/dist-packages/deployer/cli.py", line 228, in run
    importer.Importer(env, deployment, options).run()
  File "/usr/lib/python2.7/dist-packages/deployer/action/importer.py", line 202, in run
    self.add_units()
  File "/usr/lib/python2.7/dist-packages/deployer/action/importer.py", line 22, in add_units
    env_status = self.env.status()
  File "/usr/lib/python2.7/dist-packages/deployer/env/go.py", line 203, in status
    return self.client.get_stat()
  File "/usr/lib/python2.7/dist-packages/jujuclient.py", line 599, in get_stat
    return StatusTranslator().run(watch)
  File "/usr/lib/python2.7/dist-packages/jujuclient.py", line 999, in run
    self._unit(d)
  File "/usr/lib/python2.7/dist-packages/jujuclient.py", line 1031, in _unit
    for p in ports:
TypeError: 'NoneType' object is not iterable
Traceback (most recent call last):
  File "/home/sanjar/development/charms/trusty/kibana/tests/11-scale-elastic.py", line 25, in <module>
    d.setup(timeout=seconds)
  File "/usr/lib/python3/dist-packages/amulet/deployer.py", line 315, in setup
    ], cwd=self.deployer_dir)
  File "/usr/lib/python3.4/subprocess.py", line 557, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['juju-deployer', '-W', '-L', '-c', '/tmp/amulet-juju-deployer-6ikpb2xh.json', '-e', 'local', '-t', '20100', 'local']' returned non-zero exit status 1

Shouldn't cs:precise/logstash-indexer be replaced by cs:trusty/logstash-indexer

review: Needs Fixing
Revision history for this message
nicopace (nicopace) wrote :

> Shouldn't cs:precise/logstash-indexer be replaced by cs:trusty/logstash-
> indexer

I didn't used a trusty version because there is no such version.

Revision history for this message
nicopace (nicopace) wrote :

@asanjar bump

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

Amir's failure was caused by juju:

https://bugs.launchpad.net/juju-core/+bug/1425435

And nicopace is correct, there's not a trusty version of logstash-indexer yet.. Using the precise charm for the test should be okay.

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

With the work-around of `pip install -U juju-deployer`, I still had failures on the 11-scale-elastic.py test due to:

  * Bad path to 11-scale-elastic-query.json file
  * Invalid JSON in said query file (True instead of true)
  * Param error in requests.get() call (data instead of params)

I created a MP with fixes for these that allow all of the tests to pass for me: https://code.launchpad.net/~johnsca/charms/trusty/kibana/all-tests/+merge/252805

With my changes, I would give this a +1.

Revision history for this message
nicopace (nicopace) wrote :

Merge done :)

Revision history for this message
Tim Van Steenburgh (tvansteenburgh) wrote :

Nico, are you sure you merged Cory's changes into your branch? I don't see new commits, and the test still fails as of this morning (http://reports.vapour.ws/charm-test-details/charm-bundle-test-parent-158).

Revision history for this message
nicopace (nicopace) wrote :

@tvansteenburgh i have merged corys changes... i thought launchpad was going to do it by itself, but had to do it manually.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'tests/11-scale-elastic-query.json'
2--- tests/11-scale-elastic-query.json 1970-01-01 00:00:00 +0000
3+++ tests/11-scale-elastic-query.json 2015-02-27 18:42:58 +0000
4@@ -0,0 +1,49 @@
5+{
6+ "query": {
7+ "filtered": {
8+ "query": {
9+ "bool": {
10+ "should": [
11+ {
12+ "query_string": {
13+ "query": "*"
14+ }
15+ }
16+ ]
17+ }
18+ },
19+ "filter": {
20+ "bool": {
21+ "must": [
22+ {
23+ "terms": {
24+ "_type": [
25+ "1"
26+ ]
27+ }
28+ }
29+ ]
30+ }
31+ }
32+ }
33+ },
34+ "highlight": {
35+ "fields": {},
36+ "fragment_size": 2147483647,
37+ "pre_tags": [
38+ "@start-highlight@"
39+ ],
40+ "post_tags": [
41+ "@end-highlight@"
42+ ]
43+ },
44+ "size": 500,
45+ "sort": [
46+ {
47+ "_score": {
48+ "order": "desc",
49+ "ignore_unmapped": True
50+ }
51+ }
52+ ]
53+}
54
55=== added file 'tests/11-scale-elastic.py'
56--- tests/11-scale-elastic.py 1970-01-01 00:00:00 +0000
57+++ tests/11-scale-elastic.py 2015-02-27 18:42:58 +0000
58@@ -0,0 +1,71 @@
59+#!/usr/bin/python3
60+import sys
61+import time
62+import json
63+
64+import amulet
65+import requests
66+
67+seconds = 20000
68+
69+d = amulet.Deployment(series='trusty')
70+
71+d.add('kibana')
72+d.add('elasticsearch')
73+d.add('logstash-indexer', charm='cs:precise/logstash-indexer')
74+
75+d.add_unit('elasticsearch', 2)
76+
77+d.relate('logstash-indexer:cluster', 'elasticsearch:client')
78+d.relate('kibana:rest', 'elasticsearch:client')
79+
80+d.expose('kibana')
81+
82+try:
83+ d.setup(timeout=seconds)
84+except amulet.helpers.TimeoutError:
85+ amulet.raise_status(amulet.SKIP, msg="Environment wasn't stood up in time")
86+except:
87+ raise
88+
89+
90+##
91+# Set relationship aliases
92+##
93+kibana_unit = d.sentry.unit['kibana/0']
94+elasticsearch_unit = d.sentry.unit['elasticsearch/1']
95+
96+
97+def test_web_interface():
98+
99+ elasticsearch_unit.run("""
100+ curl -X POST 'http://127.0.0.1:9200/person/1' -d '{
101+ "info" : {
102+ "height" : 2,
103+ "width" : 20
104+ }
105+ }'
106+ """)
107+
108+ time.sleep(3)
109+
110+ url = 'http://%s/_all/_search' % kibana_unit.info['public-address']
111+ r = requests.get(url,
112+ data=json.load(open('11-scale-elastic-query.json')))
113+ if not r.ok:
114+ amulet.raise_status(amulet.FAIL,
115+ msg="Error connecting.")
116+ try:
117+ result = r.json()
118+ if result['hits']['total'] != 1:
119+ amulet.raise_status(amulet.FAIL,
120+ msg="Error inserting value in elasticsearch.")
121+ except ValueError:
122+ exc_type, value, traceback = sys.exc_info()
123+ exc_text = "Exception: (%s) %s. %s" % (value, exc_type, traceback)
124+ amulet.raise_status(amulet.FAIL,
125+ msg="Value returned not a valid json." + r.text +
126+ exc_text)
127+
128+
129+test_web_interface()

Subscribers

People subscribed via source and target branches