~ibmcharmers/charms/trusty/ibm-mq/devel

« back to all changes in this revision

Viewing changes to tests/10-bundles-test.py

  • Committer: anitanayak at ibm
  • Date: 2017-02-15 08:54:14 UTC
  • Revision ID: anitanayak@in.ibm.com-20170215085414-hdjj8hr2tssjolt2
checkin after review comment incorporation to interface interface-ibm-mq

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
import yaml
7
7
import amulet
8
8
import sys
9
 
import time
10
 
import requests
11
9
 
12
10
# Lots of prereqs on this charm (eg: java), so give it a large timeout
13
11
seconds_to_wait = 1500
42
40
        print('Using license_accepted  %s' % license_accepted)
43
41
        # Test if a license_accepted is defined
44
42
        if not license_accepted:
45
 
            print("You need to define a license_accepted for the IBM MQ product"
46
 
                  " repository.\n Edit local.yaml or tests/00-setup"
 
43
            print("You need to define a license_accepted for the IBM MQ"
 
44
                  " product repository.\n Edit local.yaml or tests/00-setup"
47
45
                  " and run it again.")
48
46
            sys.exit(1)
49
47
 
50
48
        d.add('ibm-mq')
51
 
        
 
49
 
52
50
        # Software doesn't actually install until you accept the license
53
51
        d.configure('ibm-mq', {'license_accepted': license_accepted,
54
 
                                 'curl_url': curl_url,
55
 
                                 'curl_opts': curl_opts})
56
 
        
 
52
                               'curl_url': curl_url,
 
53
                               'curl_opts': curl_opts})
 
54
 
57
55
        d.setup(seconds_to_wait)
58
56
        d.sentry.wait(seconds_to_wait)
59
57
        cls.d = d
63
61
        self.assertTrue(self.d.deployed)
64
62
 
65
63
    def test_running(self):
66
 
        """ Test that, if deployed, everything is set up and running correctly. """
 
64
        """ Test that, if deployed,
 
65
            everything is set up and running correctly. """
67
66
        ibm_mq_unit = self.d.sentry.unit['ibm-mq'][0]
68
67
 
69
68
        # Configure system values
70
69
        output, code = ibm_mq_unit.run('sysctl kernel.shmmax | cut -d= -f2')
71
70
        print(output)
72
71
        if code != 0 or int(output) < 268435456:
73
 
            # this isn't really a pass/fail test, as it depends on the environment
74
 
            # to which the charm is deployed, and doesn't block the install
75
 
            print('Unable to set kernel.shmmax value (perhaps on local provider?).')
 
72
            # this isn't really a pass/fail test, as it depends
 
73
            # on the environment to which
 
74
            # the charm is deployed, and doesn't block the install
 
75
            print('Unable to set kernel.shmmax'
 
76
                  ' value (perhaps on local provider?).')
76
77
 
77
78
        output, code = ibm_mq_unit.run('sysctl fs.file-max | cut -d= -f2')
78
79
        print(output)
79
80
        if code != 0 or int(output) < 524288:
80
 
            # this isn't really a pass/fail test, as it depends on the environment
81
 
            # to which the charm is deployed, and doesn't block the install
 
81
            # this isn't really a pass/fail test, as it depends
 
82
            # on the environment to which
 
83
            # the charm is deployed, and doesn't block the install
82
84
            print('Unable to set fs.file value (perhaps on local provider?).')
83
85
 
84
86
        output, code = ibm_mq_unit.run('sysctl -p')
105
107
 
106
108
if __name__ == '__main__':
107
109
    unittest.main()
108