~verterok/charms/trusty/logstash-agent/static-indexer

« back to all changes in this revision

Viewing changes to tests/13-basic-logstash-indexer-stack.py

  • Committer: Marco Ceppi
  • Date: 2015-03-24 18:46:41 UTC
  • mfrom: (6.1.7 all-tests)
  • Revision ID: marco@ceppi.net-20150324184641-tuc2kjy0shzymkrp
[nicopace] Testing for charm

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python3
 
2
import amulet
 
3
import requests
 
4
 
 
5
seconds = 20000
 
6
 
 
7
d = amulet.Deployment(series='trusty')
 
8
 
 
9
d.add('kibana')
 
10
d.add('auth-proxy', charm='cs:~paulcz/precise/auth-proxy-0')
 
11
d.add('logstash-agent')
 
12
d.add('logstash-indexer', charm='cs:precise/logstash-indexer-4')
 
13
d.configure('auth-proxy', {
 
14
    'ServerAdmin': 'kibana@example.com',
 
15
    'ServerName': 'kibana.example.com',
 
16
    'DestinationURL': 'http://127.0.0.1:5601/'
 
17
})
 
18
d.relate('auth-proxy:juju-info', 'kibana:juju-info')
 
19
d.relate('kibana:juju-info', 'logstash-agent:juju-info')
 
20
d.relate('kibana:rest', 'logstash-indexer:rest')
 
21
d.relate('logstash-agent:input', 'logstash-indexer:input')
 
22
 
 
23
d.expose('auth-proxy')
 
24
 
 
25
try:
 
26
    d.setup(timeout=seconds)
 
27
except amulet.helpers.TimeoutError:
 
28
    amulet.raise_status(amulet.SKIP, msg="Environment wasn't stood up in time")
 
29
except:
 
30
    raise
 
31
 
 
32
 
 
33
##
 
34
# Set relationship aliases
 
35
##
 
36
agent_unit = d.sentry.unit['kibana/0']
 
37
 
 
38
 
 
39
def test_running():
 
40
    r = requests.get('https://%s:5601' % agent_unit.info['public_address'])
 
41
    if r.status_code != 200:
 
42
        amulet.raise_status(amulet.FAIL,
 
43
                            msg="Error connecting via SSL.")
 
44
 
 
45
 
 
46
test_running()