Petr Horáček has uploaded a new change for review.

Change subject: test: validate that OVS tests runs as root
......................................................................

test: validate that OVS tests runs as root

Move OVS service handling to class level, as they it is not needed
for all classes (TestOvsVsctlCommand).

This patch is needed to fix non-root RPM builds on docker.

Change-Id: I04404531ad85ca357dce3ed72ca7fd3f2be9c533
Signed-off-by: Petr Horáček <phora...@redhat.com>
---
M tests/network/ovs_driver_test.py
1 file changed, 14 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/52/56952/1

diff --git a/tests/network/ovs_driver_test.py b/tests/network/ovs_driver_test.py
index 31249d3..c9e59a4 100644
--- a/tests/network/ovs_driver_test.py
+++ b/tests/network/ovs_driver_test.py
@@ -26,20 +26,10 @@
 from .nettestlib import dummy_device
 from .ovsnettestlib import OvsService, TEST_BRIDGE, TEST_BOND
 from testlib import VdsmTestCase
+from testValidation import ValidateRunningAsRoot
 
 from vdsm.network.ovs.driver import create
 from vdsm.network.ovs.driver import vsctl
-
-
-ovs_service = OvsService()
-
-
-def setup_module():
-    ovs_service.setup()
-
-
-def teardown_module():
-    ovs_service.teardown()
 
 
 @attr(type='unit')
@@ -182,6 +172,14 @@
 @attr(type='integration')
 class TestOvsApiBase(VdsmTestCase):
 
+    @ValidateRunningAsRoot
+    def setUp(self):
+        self.ovs_service = OvsService()
+        self.ovs_service.setup()
+
+    def tearDown(self):
+        self.ovs_service.teardown()
+
     def test_instantiate_vsctl_implementation(self):
         self.assertIsNotNone(create('vsctl'))
 
@@ -216,13 +214,17 @@
 @attr(type='integration')
 class TestOvsApiWithSingleRealBridge(VdsmTestCase):
 
+    @ValidateRunningAsRoot
     def setUp(self):
-        self.ovsdb = create()
+        self.ovs_service = OvsService()
+        self.ovs_service.setup()
 
+        self.ovsdb = create()
         self.ovsdb.add_br(TEST_BRIDGE).execute()
 
     def tearDown(self):
         self.ovsdb.del_br(TEST_BRIDGE).execute()
+        self.ovs_service.teardown()
 
     def test_create_vlan_as_fake_bridge(self):
         with self.ovsdb.transaction() as t:


-- 
To view, visit https://gerrit.ovirt.org/56952
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I04404531ad85ca357dce3ed72ca7fd3f2be9c533
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Petr Horáček <phora...@redhat.com>
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to