~ubuntu-branches/ubuntu/raring/quantum/raring-proposed

« back to all changes in this revision

Viewing changes to quantum/tests/unit/test_agent_netns_cleanup.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Chuck Short, Yolanda Robla, James Page, Maru Newby
  • Date: 2013-01-11 09:14:35 UTC
  • mfrom: (2.1.17)
  • Revision ID: package-import@ubuntu.com-20130111091435-vaup7dwmtmajy5oe
Tags: 2013.1~g2-0ubuntu1
[ Chuck Short ]
* New upstream version. 
* debian/patches/fix-quantum-configuration.patch: Refreshed.

[ Yolanda Robla ]
* debian/quantum-l3-agent.quantum-metadata-agent.upstart: Add
  upstart configuration for Metadata Agent.
* debian/quantum-l3-agent.install: Added quantum-ns-metadata-proxy,
  quantum-metadata-agent and metadata_agent.ini.
* debian/patches/fix-quantum-configuration.patch: Update rootwrap
  configuration in metadata_agent.ini file.
* debian/changelog: Updated package version
* d/p/fix-quantum-configuration.patch: refresh patches

[ James Page ]
* d/*.install: Install entry points from bin directory instead
  of easy-install ones generated during the package build process
  (LP: #1085038).
* d/control: Drop BD on python-dev-all; its not required.
* d/rules: Install multiple upstart configurations for quantum-l3-agent.
* d/control: Tidy package descriptions.
* d/*.postrm: Drop as debhelper will generate update-rc.d calls in
  maintainer scripts if required.
* d/quantum-common.postinst: Tweak permissions setting so that /etc/quantum
  is not owned/writable by the quantum user, ensure that /etc/quantum/rootwrap*
  is owned by root:root.
* d/*agent*.postinst: Dropped as permissions now correctly set in
  quantum-common.
* d/patches/fix-quantum-configuration.patch: Re-add dropped fixes rootwrap and
  sqlite defaults for all plugins.
* d/control: Added new BD on alembic (>= 0.4.1~), version python-mock >= 1.0b1.

[ Maru Newby ]
* debian/control: Remove unnecessary openvswitch-vswitch dependency
  from quantum-plugin-openvswitch (LP: #1076747).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# vim: tabstop=4 shiftwidth=4 softtabstop=4
 
2
 
 
3
# Copyright (c) 2012 OpenStack LLC.
 
4
# All Rights Reserved.
 
5
#
 
6
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
 
7
#    not use this file except in compliance with the License. You may obtain
 
8
#    a copy of the License at
 
9
#
 
10
#         http://www.apache.org/licenses/LICENSE-2.0
 
11
#
 
12
#    Unless required by applicable law or agreed to in writing, software
 
13
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 
14
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 
15
#    License for the specific language governing permissions and limitations
 
16
#    under the License.
 
17
 
1
18
import mock
2
19
import unittest2 as unittest
3
20
 
4
21
from quantum.agent import netns_cleanup_util as util
5
22
 
6
23
 
 
24
class TestNullDelegate(unittest.TestCase):
 
25
    def test_getattribute(self):
 
26
        null_delegate = util.NullDelegate()
 
27
        self.assertIsNone(null_delegate.test())
 
28
 
 
29
 
7
30
class TestNetnsCleanup(unittest.TestCase):
8
31
    def test_setup_conf(self):
9
32
        with mock.patch('quantum.common.config.setup_logging'):
118
141
 
119
142
                    mock_get_bridge_for_iface.assert_called_once_with(
120
143
                        conf.root_helper, 'tap1')
121
 
                    self.assertEquals(ovs_br_cls.mock_calls, [])
 
144
                    self.assertEqual(ovs_br_cls.mock_calls, [])
122
145
                    self.assertTrue(debug.called)
123
146
 
124
147
    def _test_destroy_namespace_helper(self, force, num_devices):
159
182
                    expected.append(mock.call().garbage_collect_namespace())
160
183
                    ip_wrap.assert_has_calls(expected)
161
184
 
162
 
    def test_destory_namespace_empty(self):
 
185
    def test_destroy_namespace_empty(self):
163
186
        self._test_destroy_namespace_helper(False, 0)
164
187
 
165
 
    def test_destory_namespace_not_empty(self):
 
188
    def test_destroy_namespace_not_empty(self):
166
189
        self._test_destroy_namespace_helper(False, 1)
167
190
 
168
 
    def test_destory_namespace_not_empty_forced(self):
 
191
    def test_destroy_namespace_not_empty_forced(self):
169
192
        self._test_destroy_namespace_helper(True, 2)
170
193
 
 
194
    def test_destroy_namespace_exception(self):
 
195
        ns = 'qrouter-6e322ac7-ab50-4f53-9cdc-d1d3c1164b6d'
 
196
        conf = mock.Mock()
 
197
        conf.root_helper = 'sudo'
 
198
        with mock.patch('quantum.agent.linux.ip_lib.IPWrapper') as ip_wrap:
 
199
            ip_wrap.side_effect = Exception()
 
200
            util.destroy_namespace(conf, ns)
 
201
 
171
202
    def test_main(self):
172
203
        namespaces = ['ns1', 'ns2']
173
204
        with mock.patch('quantum.agent.linux.ip_lib.IPWrapper') as ip_wrap: