7
seconds_to_wait = 20000
9
class TestDeploy(unittest.TestCase):
11
Deployment test for the IBM WAS Base charm.
14
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')
18
self.d.setup(seconds_to_wait)
19
self.d.sentry.wait(seconds_to_wait)
21
def test_deploy_with_placeholder_resource(self):
22
# The status message when using placeholder resources will include the
23
# string "ibm_was_base_installer resource". If we see that, the test is
25
sentry_re = re.compile('ibm_was_base_installer resource')
26
self.d.sentry.wait_for_messages({"ibm-was-base": sentry_re})
28
def test_was_base_deployed(self):
29
self.assertTrue(self.d.deployed)
30
unit = self.d.sentry['ibm-was-base'][0]
31
state_was_base = unit_master_0.info['agent-state']
32
print('WAS Base Server is %s' % state_was_base)
33
url = 'http://%s:9060/ibm/console' % unit.info['public-address']
34
https_url = 'https://%s:9043/ibm/console' % unit.info['public-address']
35
response = requests.get(url, verify=False)
36
response = requests.get(https_url, verify=False)
37
# Raise an exception if the url was not a valid web page.
38
response.raise_for_status()
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()
50
if __name__ == '__main__':