~ubuntu-branches/ubuntu/vivid/neutron/vivid-updates

« back to all changes in this revision

Viewing changes to neutron/tests/functional/agent/linux/test_ovsdb_monitor.py

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2015-03-30 11:17:19 UTC
  • mfrom: (1.1.21)
  • Revision ID: package-import@ubuntu.com-20150330111719-h0gx7233p4jkkgfh
Tags: 1:2015.1~b3-0ubuntu1
* New upstream milestone release:
  - d/control: Align version requirements with upstream.
  - d/control: Add new dependency on oslo-log.
  - d/p/*: Rebase.
  - d/control,d/neutron-plugin-hyperv*: Dropped, decomposed into
    separate project upstream.
  - d/control,d/neutron-plugin-openflow*: Dropped, decomposed into
    separate project upstream.
  - d/neutron-common.install: Add neutron-rootwrap-daemon and 
    neutron-keepalived-state-change binaries.
  - d/rules: Ignore neutron-hyperv-agent when installing; only for Windows.
  - d/neutron-plugin-cisco.install: Drop neutron-cisco-cfg-agent as
    decomposed into separate project upstream.
  - d/neutron-plugin-vmware.install: Drop neutron-check-nsx-config and
    neutron-nsx-manage as decomposed into separate project upstream.
  - d/control: Add dependency on python-neutron-fwaas to neutron-l3-agent.
* d/pydist-overrides: Add overrides for oslo packages.
* d/control: Fixup type in package description (LP: #1263539).
* d/p/fixup-driver-test-execution.patch: Cherry pick fix from upstream VCS
  to support unit test exection in out-of-tree vendor drivers.
* d/neutron-common.postinst: Allow general access to /etc/neutron but limit
  access to root/neutron to /etc/neutron/neutron.conf to support execution
  of unit tests in decomposed vendor drivers.
* d/control: Add dependency on python-neutron-fwaas to neutron-l3-agent
  package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
"""
24
24
 
25
25
import eventlet
 
26
from oslo_config import cfg
26
27
 
27
28
from neutron.agent.linux import ovsdb_monitor
28
29
from neutron.agent.linux import utils
35
36
    def setUp(self):
36
37
        super(BaseMonitorTest, self).setUp()
37
38
 
38
 
        rootwrap_not_configured = (self.root_helper ==
 
39
        rootwrap_not_configured = (cfg.CONF.AGENT.root_helper ==
39
40
                                   functional_base.SUDO_CMD)
40
41
        if rootwrap_not_configured:
41
42
            # The monitor tests require a nested invocation that has
42
43
            # to be emulated by double sudo if rootwrap is not
43
44
            # configured.
44
 
            self.root_helper = '%s %s' % (self.root_helper, self.root_helper)
 
45
            self.config(group='AGENT',
 
46
                        root_helper=" ".join([functional_base.SUDO_CMD] * 2))
45
47
 
46
48
        self._check_test_requirements()
47
49
        self.bridge = self.create_ovs_bridge()
48
50
 
49
51
    def _check_test_requirements(self):
50
 
        self.check_sudo_enabled()
51
52
        self.check_command(['ovsdb-client', 'list-dbs'],
52
53
                           'Exit code: 1',
53
54
                           'password-less sudo not granted for ovsdb-client',
54
 
                           root_helper=self.root_helper)
 
55
                           run_as_root=True)
55
56
 
56
57
 
57
58
class TestOvsdbMonitor(BaseMonitorTest):
59
60
    def setUp(self):
60
61
        super(TestOvsdbMonitor, self).setUp()
61
62
 
62
 
        self.monitor = ovsdb_monitor.OvsdbMonitor('Bridge',
63
 
                                                  root_helper=self.root_helper)
 
63
        self.monitor = ovsdb_monitor.OvsdbMonitor('Bridge')
64
64
        self.addCleanup(self.monitor.stop)
65
65
        self.monitor.start()
66
66
 
78
78
        self.monitor.respawn_interval = 0
79
79
        old_pid = self.monitor._process.pid
80
80
        output1 = self.collect_initial_output()
81
 
        pid = utils.get_root_helper_child_pid(old_pid, self.root_helper)
 
81
        pid = utils.get_root_helper_child_pid(old_pid, run_as_root=True)
82
82
        self.monitor._kill_process(pid)
83
83
        self.monitor._reset_queues()
84
84
        while (self.monitor._process.pid == old_pid):
93
93
    def setUp(self):
94
94
        super(TestSimpleInterfaceMonitor, self).setUp()
95
95
 
96
 
        self.monitor = ovsdb_monitor.SimpleInterfaceMonitor(
97
 
            root_helper=self.root_helper)
 
96
        self.monitor = ovsdb_monitor.SimpleInterfaceMonitor()
98
97
        self.addCleanup(self.monitor.stop)
99
98
        self.monitor.start(block=True, timeout=60)
100
99