~ibmcharmers/charms/xenial/layer-ibm-was-base/trunk

« back to all changes in this revision

Viewing changes to tests/01-deploy.py

  • Committer: Rajith Venkata
  • Date: 2016-12-12 09:37:54 UTC
  • Revision ID: rajith.pv@in.ibm.com-20161212093754-8uq6oqkqsicgssvs
Committing ibm was base layered charm for z platform

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
import amulet
4
4
import re
 
5
import requests
5
6
import unittest
6
7
 
7
8
seconds_to_wait = 20000
8
9
 
 
10
 
9
11
class TestDeploy(unittest.TestCase):
10
12
    """
11
13
    Deployment test for the IBM WAS Base charm.
12
14
    """
13
15
    def setUp(self):
14
16
        self.d = amulet.Deployment(series='trusty')
15
 
        self.d.add('ibm-was-base', 'cs:~ibmcharmers/trusty/ibm-was-base')
16
 
        self.d.add('ibm-http', 'cs:~ibmcharmers/trusty/ibm-http')
17
 
        self.d.relate('ibm-was-base:was-ihs', 'ibm-http:ihs')
 
17
        self.d.add('ibm-was-base', 'cs:~ibmcharmers/xenial/ibm-was-base')
18
18
        self.d.setup(seconds_to_wait)
19
19
        self.d.sentry.wait(seconds_to_wait)
20
20
 
25
25
        sentry_re = re.compile('ibm_was_base_installer resource')
26
26
        self.d.sentry.wait_for_messages({"ibm-was-base": sentry_re})
27
27
 
28
 
   def test_was_base_deployed(self):
 
28
    def test_was_base_deployed(self):
29
29
        self.assertTrue(self.d.deployed)
30
30
        unit = self.d.sentry['ibm-was-base'][0]
31
 
        state_was_base = unit_master_0.info['agent-state']
 
31
        state_was_base = unit.info['agent-state']
32
32
        print('WAS Base Server is %s' % state_was_base)
33
 
        url  = 'http://%s:9060/ibm/console' % unit.info['public-address']
 
33
        url = 'http://%s:9060/ibm/console' % unit.info['public-address']
34
34
        https_url = 'https://%s:9043/ibm/console' % unit.info['public-address']
35
35
        response = requests.get(url, verify=False)
36
36
        response = requests.get(https_url, verify=False)
37
37
        # Raise an exception if the url was not a valid web page.
38
38
        response.raise_for_status()
39
39
 
40
 
    def test_was_ihs(self):
41
 
        http_unit = self.d.sentry['ibm-http'][0]
42
 
        state_http = unit_master_0.info['agent-state']
43
 
        print('Http Server is %s' % state_http)
44
 
        url  = 'http://%s:80' % http_unit.info['public-address']
45
 
        snoop_url = 'http://%s:80/snoop' % http_unit.info['public-address']
46
 
        response = requests.get(url, verify=False)
47
 
        response = requests.get(snoop_url, verify=False)
48
 
        response.raise_for_status()
49
40
 
50
41
if __name__ == '__main__':
51
42
    unittest.main()