~ibmcharmers/charms/trusty/layer-ibm-mobilefirst-server/devel

« back to all changes in this revision

Viewing changes to tests/01-deploy_mobilefirst.py

  • Committer: Shilpa Kaul
  • Date: 2016-11-07 18:26:51 UTC
  • Revision ID: shilkaul@in.ibm.com-20161107182651-17y81qkvu1lmsdkc
lint changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
            sys.exit(1)
37
37
 
38
38
        self.d.add('ibm-db2', 'cs:~ibmcharmers/trusty/ibm-db2')
 
39
        #self.d.add('ibm-db2', 'cs:~shilkaul/trusty/ibm-db2-0')
39
40
        self.d.add('websphere-liberty',
40
41
                   'cs:~ibmcharmers/trusty/websphere-liberty')
41
42
        self.d.add('ibm-mobilefirst-server',
45
46
        self.d.configure('websphere-liberty',
46
47
                         {'accept-ibm-java-license': True})
47
48
        self.d.configure('ibm-db2', {'license_accepted': True,
48
 
                         'curl_url': curl_url, 'curl_opts': curl_opts})
49
 
 
50
 
        self.d.setup(timeout=900)
51
 
        self.d.sentry.wait(timeout=1800)
 
49
                        'curl_url': curl_url, 'curl_opts': curl_opts})
 
50
 
 
51
        self.d.relate('websphere-liberty:website','ibm-mobilefirst-server:website')
 
52
        self.d.relate('ibm-db2:db','ibm-mobilefirst-server:mobilefirstserverdb')
 
53
 
 
54
 
 
55
        self.d.setup(timeout=1200)
 
56
        self.d.sentry.wait(timeout=1200)
52
57
 
53
58
    def test_deploy_with_placeholder_resource(self):
54
59
        # The status message when using placeholder resources will include the
55
 
        # string "ibm_im_installer resource". If we see that, the test is
 
60
        # string "ibm_mobilefirstserver_installer resource". If we see that, the test is
56
61
        # successful.
57
62
        sentry_re = re.compile('ibm_mobilefirstserver_installer resource')
58
63
        self.d.sentry.wait_for_messages({"ibm-mobilefirstserver": sentry_re})
59
64
 
 
65
    def test_mobilefirst_server_deployed(self):
 
66
        self.assertTrue(self.d.deployed)
 
67
        unit = self.d.sentry['ibm-mobilefirst-server'][0]
 
68
        state_worklight = unit.info['agent-state']
 
69
        print('Mobile First Server is %s' % state_worklight)
 
70
        url = 'http://%s:9081/appcenterconsole' % unit.info['public-address']
 
71
        https_url = 'https://%s:9443/appcenterconsole' % unit.info['public-address']
 
72
        response = requests.get(url, verify=False)
 
73
        response = requests.get(https_url, verify=False)
 
74
        # Raise an exception if the url was not a valid web page.
 
75
        response.raise_for_status()
 
76
 
60
77
if __name__ == '__main__':
61
78
    unittest.main()