~ibmcharmers/charms/trusty/layer-ibm-platform-lsf-server/trunk

« back to all changes in this revision

Viewing changes to tests/01-deploy.py

  • Committer:
  • Date: 2016-11-02 06:29:10 UTC
  • Revision ID: shilkaul@in.ibm.com-20161102062910-gs67gih8tsev2u22
Incorporated review comments

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/env python3
2
2
 
3
 
import os
4
3
import unittest
5
 
import yaml
6
4
import amulet
7
 
import sys
8
5
import time
9
6
import re
10
7
 
19
16
        """
20
17
        Deployment test for IBM Platform LSF Server
21
18
        """
22
 
 
23
19
        self.d = amulet.Deployment(series='trusty')
24
 
        self.d.add('ibm-platform-lsf-storage')
25
 
        self.d.add('ibm-platform-lsf-master')
26
 
        self.d.add('ibm-platform-lsf-server')
27
 
        self.d.relate('ibm-platform-lsf-storage:storage', 'ibm-platform-lsf-master:storage')
28
 
        self.d.relate('ibm-platform-lsf-storage:storage', 'ibm-platform-lsf-server:storage')
 
20
        self.d.add('ibm-platform-lsf-storage',
 
21
                   'cs:~ibmcharmers/trusty/ibm-platform-lsf-storage')
 
22
        self.d.add('ibm-platform-lsf-master',
 
23
                   'cs:~ibmcharmers/trusty/ibm-platform-lsf-master')
 
24
        self.d.add('ibm-platform-lsf-server',
 
25
                   'cs:~ibmcharmers/trusty/ibm-platform-lsf-server')
 
26
        self.d.relate('ibm-platform-lsf-storage:storage',
 
27
                      'ibm-platform-lsf-master:storage')
 
28
        self.d.relate('ibm-platform-lsf-storage:storage',
 
29
                      'ibm-platform-lsf-server:storage')
29
30
        time.sleep(100)
30
 
        self.d.relate('ibm-platform-lsf-storage:master', 'ibm-platform-lsf-server:master')
 
31
        self.d.relate('ibm-platform-lsf-storage:master',
 
32
                      'ibm-platform-lsf-server:master')
31
33
        self.d.setup(seconds_to_wait)
32
 
        self.d.sentry.wait(seconds_to_wait) 
33
 
 
34
34
 
35
35
    def test_deploy_with_placeholder_resource(self):
36
36
        # The status message when using placeholder resources will include the
37
37
        # string "ibm_lsf_installer resource".
38
38
        # If we see that, the test is successful.
39
39
        sentry_re = re.compile('ibm_lsf_installer resource')
40
 
        self.d.sentry.wait_for_messages({"ibm-platform-lsf-storage": sentry_re})
 
40
        self.d.sentry.wait_for_messages({"ibm-platform-lsf-storage":
 
41
                                        sentry_re})
41
42
 
42
 
         
43
43
    def test_unit_deployed(self):
44
44
        # verify unit
45
45
        self.assertTrue(self.d.deployed)
48
48
        print('Server state is %s' % state_server)
49
49
        server_ip = unit_server_0.info['public-address']
50
50
        print('Server IP is %s' % server_ip)
51
 
        cmd1, code = unit_server_0.run(". /usr/share/lsf/conf/profile.lsf;/usr/share/lsf/*/*/bin/bhosts")
 
51
        cmd1, code = unit_server_0.run(". /usr/share/lsf/conf/profile.lsf;\
 
52
                                       /usr/share/lsf/*/*/bin/bhosts")
52
53
        if code != 0:
53
 
         message = 'bhosts command failed to run , may be LSF is down.'
54
 
         amulet.raise_status(amulet.FAIL, msg=message)
 
54
            message = 'bhosts command failed to run , may be LSF is down.'
 
55
            amulet.raise_status(amulet.FAIL, msg=message)
55
56
        print('The output of running bhosts command on server host is \n')
56
57
        print(str(cmd1))
57
 
        
 
58
 
58
59
 
59
60
if __name__ == '__main__':
60
 
    unittest.main()    unittest.main()
 
 
b'\\ No newline at end of file'
 
61
    unittest.main()