1
# vim: tabstop=4 shiftwidth=4 softtabstop=4
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
7
# http://www.apache.org/licenses/LICENSE-2.0
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
17
from nose.plugins.attrib import attr
23
@attr(tag=['func', 'wordpress', 'eip', 'ebs', 'F17'])
24
class WordPress2EBSEIPFunctionalTest(unittest.TestCase):
26
self.template = 'WordPress_2_Instances_With_EBS_EIP.template'
28
stack_paramstr = ';'.join(['InstanceType=m1.xlarge',
30
'DBPassword=' + os.environ['OS_PASSWORD']])
32
self.stack = util.Stack(self, self.template,
33
'F17', 'x86_64', 'cfntools',
36
self.webserver = util.Instance(self, 'WebServer')
38
self.database = util.Instance(self, 'WikiDatabase')
43
def test_instance(self):
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)
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)
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')
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')
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)
78
# Check the floating IPs
80
self.webserver.floating_ip_present(),
81
'WebServer instance does not have a floating IP assigned')
83
self.database.floating_ip_present(),
84
'WikiDatabase instance does not have a floating IP assigned')
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()
91
ver.verify_wordpress(stack_url),
92
'Wordpress is not accessible at: %s' % stack_url)