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
24
@attr(tag=['func', 'wordpress', 'eip', 'F17',
25
'WordPress_Single_Instance_With_EIP.template'])
26
class WordPressEIPFunctionalTest(unittest.TestCase):
28
template = 'WordPress_Single_Instance_With_EIP.template'
30
stack_paramstr = ';'.join(['InstanceType=m1.xlarge',
32
'DBPassword=' + os.environ['OS_PASSWORD']])
34
self.stack = util.Stack(self, template, 'F17', 'x86_64', 'cfntools',
36
self.WebServer = util.Instance(self, 'WebServer')
41
def test_instance(self):
43
self.WebServer.wait_for_boot()
44
self.WebServer.check_cfntools()
45
self.WebServer.wait_for_provisioning()
47
# ensure wordpress was installed
48
self.assertTrue(self.WebServer.file_present
49
('/etc/wordpress/wp-config.php'))
50
print "Wordpress installation detected"
52
# 2. check floating ip assignment
53
if len(self.stack.novaclient.floating_ips.list()) == 0:
54
print 'zero floating IPs detected'
55
self.assertTrue(False)
58
mylist = self.stack.novaclient.floating_ips.list()
60
if item.instance_id == self.stack.instance_phys_ids()[0]:
61
print 'floating IP found', item.ip
64
self.assertEqual(found, 1)
66
# Verify the output URL parses as expected, ie check that
67
# the wordpress installation is operational
68
# Note that the WebsiteURL uses the non-EIP address
69
stack_url = self.stack.get_stack_output("WebsiteURL")
70
print "Got stack output WebsiteURL=%s, verifying" % stack_url
71
ver = verify.VerifyStack()
72
self.assertTrue(ver.verify_wordpress(stack_url))
74
# Then the InstanceIPAddress is the EIP address
75
# which should also render the wordpress page
76
stack_eip = self.stack.get_stack_output("InstanceIPAddress")
77
eip_url = "http://%s/wordpress" % stack_eip
78
print "Got stack output InstanceIPAddress=%s, verifying url %s" %\
80
self.assertTrue(ver.verify_wordpress(eip_url))