Francesco Romani has uploaded a new change for review.
Change subject: tests: mom: create the socket under tmpdir
......................................................................
tests: mom: create the socket under tmpdir
Some tests may fail under automation if Vdsm
is built and its test are run under a too nested
directory.
This because the absolute path of the UNIX domain
socket becomes too long.
To fix this, we create the socket under a temporary
directory.
This also makes cleanup a little easier.
Change-Id: Ib41253a58e8abadeb99d57072ace75461a8e078b
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M tests/momTests.py
1 file changed, 12 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/79/62779/1
diff --git a/tests/momTests.py b/tests/momTests.py
index 764aa57..c454dcb 100644
--- a/tests/momTests.py
+++ b/tests/momTests.py
@@ -19,6 +19,8 @@
from unittest import TestCase
import logging
+import shutil
+import tempfile
import threading
from vdsm.define import Mbytes
from vdsm.momIF import MomClient
@@ -30,7 +32,7 @@
from vdsm import cpuarch
MOM_CONF = "/dev/null"
-MOM_PORT = os.path.join(os.path.dirname(__file__), "test_mom_vdsm.sock")
+MOM_SOCK = "test_mom_vdsm.sock"
class DummyMomApi(object):
@@ -67,12 +69,20 @@
# added during the tests.
@monkeypatch.MonkeyClass(logging.getLogger().manager, "loggerDict", {})
class MomPolicyTests(TestCase):
+
+ _TMP_DIR = '/tmp'
+
def setUp(self):
+ self._tmp_dir = tempfile.mkdtemp(dir=self._TMP_DIR)
self.config_overrides = configparser.SafeConfigParser()
self.config_overrides.add_section("logging")
self.config_overrides.set("logging", "log",
"stdio")
self.config_overrides.add_section("main")
- self.config_overrides.set("main", "rpc-port", str(MOM_PORT))
+ self.config_overrides.set("main", "rpc-port",
+ os.path.join(self._tmp_dir, MOM_SOCK))
+
+ def tearDown(self):
+ shutil.rmtree(self._tmp_dir)
def _getMomClient(self):
return MomClient(MOM_CONF, self.config_overrides)
--
To view, visit
https://gerrit.ovirt.org/62779
To unsubscribe, visit
https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib41253a58e8abadeb99d57072ace75461a8e078b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>