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

« back to all changes in this revision

Viewing changes to heat/tests/functional/test_WordPress_Single_Instance_With_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
 
 
19
 
import unittest
20
 
import os
21
 
 
22
 
 
23
 
@attr(speed='slow')
24
 
@attr(tag=['func', 'wordpress', 'eip', 'F17',
25
 
      'WordPress_Single_Instance_With_EIP.template'])
26
 
class WordPressEIPFunctionalTest(unittest.TestCase):
27
 
    def setUp(self):
28
 
        template = 'WordPress_Single_Instance_With_EIP.template'
29
 
 
30
 
        stack_paramstr = ';'.join(['InstanceType=m1.xlarge',
31
 
                                   'DBUsername=dbuser',
32
 
                                   'DBPassword=' + os.environ['OS_PASSWORD']])
33
 
 
34
 
        self.stack = util.Stack(self, template, 'F17', 'x86_64', 'cfntools',
35
 
                                stack_paramstr)
36
 
        self.WebServer = util.Instance(self, 'WebServer')
37
 
 
38
 
    def tearDown(self):
39
 
        self.stack.cleanup()
40
 
 
41
 
    def test_instance(self):
42
 
        self.stack.create()
43
 
        self.WebServer.wait_for_boot()
44
 
        self.WebServer.check_cfntools()
45
 
        self.WebServer.wait_for_provisioning()
46
 
 
47
 
        # ensure wordpress was installed
48
 
        self.assertTrue(self.WebServer.file_present
49
 
                        ('/etc/wordpress/wp-config.php'))
50
 
        print "Wordpress installation detected"
51
 
 
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)
56
 
        else:
57
 
            found = 0
58
 
            mylist = self.stack.novaclient.floating_ips.list()
59
 
            for item in mylist:
60
 
                if item.instance_id == self.stack.instance_phys_ids()[0]:
61
 
                    print 'floating IP found', item.ip
62
 
                    found = 1
63
 
                    break
64
 
            self.assertEqual(found, 1)
65
 
 
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))
73
 
 
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" %\
79
 
              (stack_eip, eip_url)
80
 
        self.assertTrue(ver.verify_wordpress(eip_url))