~ubuntu-branches/ubuntu/trusty/heat/trusty-security

« back to all changes in this revision

Viewing changes to heat/tests/functional/test_WordPress_2_Instances_With_EBS_EIP.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Yolanda Robla, Chuck Short
  • Date: 2013-07-22 16:22:29 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20130722162229-zzvfu40id94ii0hc
Tags: 2013.2~b2-0ubuntu1
[ Yolanda Robla ]
* debian/tests: added autopkg tests

[ Chuck Short ]
* New upstream release
* debian/control:
  - Add python-pbr to build-depends.
  - Add python-d2to to build-depends.
  - Dropped python-argparse.
  - Add python-six to build-depends.
  - Dropped python-sendfile.
  - Dropped python-nose.
  - Added testrepository.
  - Added python-testtools.
* debian/rules: Run testrepository instead of nosetets.
* debian/patches/removes-lxml-version-limitation-from-pip-requires.patch: Dropped
  no longer needed.
* debian/patches/fix-package-version-detection-when-building-doc.patch: Dropped
  no longer needed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# vim: tabstop=4 shiftwidth=4 softtabstop=4
2
 
#
3
 
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
4
 
#    not use this file except in compliance with the License. You may obtain
5
 
#    a copy of the License at
6
 
#
7
 
#         http://www.apache.org/licenses/LICENSE-2.0
8
 
#
9
 
#    Unless required by applicable law or agreed to in writing, software
10
 
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
 
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
 
#    License for the specific language governing permissions and limitations
13
 
#
14
 
 
15
 
import util
16
 
import verify
17
 
from nose.plugins.attrib import attr
18
 
import unittest
19
 
import os
20
 
 
21
 
 
22
 
@attr(speed='slow')
23
 
@attr(tag=['func', 'wordpress', 'eip', 'ebs', 'F17'])
24
 
class WordPress2EBSEIPFunctionalTest(unittest.TestCase):
25
 
    def setUp(self):
26
 
        self.template = 'WordPress_2_Instances_With_EBS_EIP.template'
27
 
 
28
 
        stack_paramstr = ';'.join(['InstanceType=m1.xlarge',
29
 
                                   'DBUsername=dbuser',
30
 
                                   'DBPassword=' + os.environ['OS_PASSWORD']])
31
 
 
32
 
        self.stack = util.Stack(self, self.template,
33
 
                                'F17', 'x86_64', 'cfntools',
34
 
                                stack_paramstr)
35
 
 
36
 
        self.webserver = util.Instance(self, 'WebServer')
37
 
 
38
 
        self.database = util.Instance(self, 'WikiDatabase')
39
 
 
40
 
    def tearDown(self):
41
 
        self.stack.cleanup()
42
 
 
43
 
    def test_instance(self):
44
 
        self.stack.create()
45
 
 
46
 
        self.webserver.wait_for_boot()
47
 
        self.webserver.check_cfntools()
48
 
        self.webserver.wait_for_provisioning()
49
 
        self.webserver.check_user_data(self.template)
50
 
 
51
 
        self.database.wait_for_boot()
52
 
        self.database.check_cfntools()
53
 
        self.database.wait_for_provisioning()
54
 
        self.database.check_user_data(self.template)
55
 
 
56
 
        # Check wordpress installation
57
 
        wp_config_file = '/etc/wordpress/wp-config.php'
58
 
        self.assertTrue(self.webserver.file_present(wp_config_file),
59
 
                        'wp-config.php is not present')
60
 
 
61
 
        # Check mysql is installed and running
62
 
        stdin, stdout, sterr = self.database.exec_command(
63
 
            'systemctl status mysqld.service')
64
 
        result = stdout.read()
65
 
        self.assertTrue('running' in result, 'mysql service is not running')
66
 
 
67
 
        # Check EBS volume is present and mounted
68
 
        stdin, stdout, sterr = self.database.exec_command(
69
 
            'grep vdc /proc/mounts')
70
 
        lines = stdout.readlines()
71
 
        self.assertTrue(len(lines) > 0)
72
 
        result = lines.pop().strip()
73
 
        self.assertTrue(len(result) > 0)
74
 
        print "Checking EBS volume is attached: %s" % result
75
 
        self.assertTrue('/dev/vdc1' in result)
76
 
        self.assertTrue('/var/lib/mysql' in result)
77
 
 
78
 
        # Check the floating IPs
79
 
        self.assertTrue(
80
 
            self.webserver.floating_ip_present(),
81
 
            'WebServer instance does not have a floating IP assigned')
82
 
        self.assertTrue(
83
 
            self.database.floating_ip_present(),
84
 
            'WikiDatabase instance does not have a floating IP assigned')
85
 
 
86
 
        # Check wordpress is running and acessible at the correct URL
87
 
        stack_url = self.stack.get_stack_output("WebsiteURL")
88
 
        print "Got stack output WebsiteURL=%s, verifying" % stack_url
89
 
        ver = verify.VerifyStack()
90
 
        self.assertTrue(
91
 
            ver.verify_wordpress(stack_url),
92
 
            'Wordpress is not accessible at: %s' % stack_url)