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

« back to all changes in this revision

Viewing changes to tests/01-deploy.py

  • Committer: Kevin W. Monroe
  • Date: 2017-01-26 00:37:17 UTC
  • Revision ID: kevin.monroe@canonical.com-20170126003717-iyksv4q8p2gsg1ne
format, whitespace, and test updates

README:
- make consistent with other lsf charms
- whitespace and other formatting fixes

reactive:
- whitespace fixes
- remove superfluous '|| true' calls

tests:
- fix incorrect relation
- sentry on correct status
- skip deployment test since it requires private resource
- chmod tests.yaml to 644

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
import unittest
4
4
import amulet
5
 
import time
6
5
import re
7
6
 
8
7
# Lots of prereqs on this charm (eg: java), so give it a large timeout
9
 
seconds_to_wait = 20000
 
8
seconds_to_wait = 1800
10
9
 
11
10
 
12
11
class BundleTest(unittest.TestCase):
27
26
                      'ibm-platform-lsf-master:storage')
28
27
        self.d.relate('ibm-platform-lsf-storage:storage',
29
28
                      'ibm-platform-lsf-server:storage')
30
 
        time.sleep(100)
31
 
        self.d.relate('ibm-platform-lsf-storage:master',
 
29
        self.d.relate('ibm-platform-lsf-master:master',
32
30
                      'ibm-platform-lsf-server:master')
33
 
        self.d.setup(seconds_to_wait)
 
31
        self.d.setup(timeout=seconds_to_wait)
34
32
 
35
33
    def test_deploy_with_placeholder_resource(self):
36
34
        # The status message when using placeholder resources will include the
37
 
        # string "ibm_lsf_installer resource".
 
35
        # string "IBM LSF resources".
38
36
        # If we see that, the test is successful.
39
 
        sentry_re = re.compile('ibm_lsf_installer resource')
 
37
        sentry_re = re.compile('IBM LSF resources')
40
38
        self.d.sentry.wait_for_messages({"ibm-platform-lsf-storage":
41
39
                                        sentry_re})
42
40
 
 
41
    @unittest.skip(
 
42
        'Skipping test until valid resources are available in the store.')
43
43
    def test_unit_deployed(self):
44
44
        # verify unit
45
45
        self.assertTrue(self.d.deployed)
46
46
        unit_server_0 = self.d.sentry['ibm-platform-lsf-server'][0]
47
 
        state_server = unit_server_0.info['agent-state']
48
 
        print('Server state is %s' % state_server)
 
47
        unit_status = unit_server_0.info['workload-status']['current']
 
48
        print('LSF Server status is %s' % unit_status)
49
49
        server_ip = unit_server_0.info['public-address']
50
 
        print('Server IP is %s' % server_ip)
 
50
        print('LSF Server IP is %s' % server_ip)
51
51
        cmd1, code = unit_server_0.run(". /usr/share/lsf/conf/profile.lsf;\
52
52
                                       /usr/share/lsf/*/*/bin/bhosts")
53
53
        if code != 0: