Change in vdsm[master]: tests: move more fakes into vmfakelib
fromani at redhat.com
fromani at redhat.com
Thu Sep 11 13:04:27 UTC 2014
Francesco Romani has uploaded a new change for review.
Change subject: tests: move more fakes into vmfakelib
......................................................................
tests: move more fakes into vmfakelib
This patch move more Fakes into the common
library, to avoid duplication and to give them
better spotlight.
Beside renames (e.g. FakeSuperVdsm -> fake.SuperVdsm)
there are no code changes.
Change-Id: Ib2f844a6586eca567fede25b193a762318badd9f
Signed-off-by: Francesco Romani <fromani at redhat.com>
---
M tests/numaUtilsTests.py
M tests/vmfakelib.py
2 files changed, 30 insertions(+), 30 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/21/32821/1
diff --git a/tests/numaUtilsTests.py b/tests/numaUtilsTests.py
index fa74116..82caf57 100644
--- a/tests/numaUtilsTests.py
+++ b/tests/numaUtilsTests.py
@@ -43,34 +43,6 @@
</domstatus>"""
-class FakeSuperVdsm:
- def __init__(self):
- pass
-
- def getProxy(self):
- return self
-
- def getVcpuNumaMemoryMapping(self, vmName):
- return {0: [0, 1], 1: [0, 1], 2: [0, 1], 3: [0, 1]}
-
-
-class FakeAdvancedStatsFunction:
- def __init__(self):
- pass
-
- def getStats(self):
- return [], [(0, 1, 19590000000L, 1),
- (1, 1, 10710000000L, 1),
- (2, 1, 19590000000L, 0),
- (3, 1, 19590000000L, 2)], 15
-
-
-class FakeVmStatsThread:
- def __init__(self, vm):
- self._vm = vm
- self.sampleVcpuPinning = FakeAdvancedStatsFunction()
-
-
class TestNumaUtils(TestCaseBase):
@MonkeyPatch(minidom, 'parse',
@@ -83,7 +55,7 @@
3: '12269'}
self.assertEqual(vcpuPids, expectedVcpuPids)
- @MonkeyPatch(numaUtils, 'supervdsm', FakeSuperVdsm())
+ @MonkeyPatch(numaUtils, 'supervdsm', fake.SuperVdsm())
@MonkeyPatch(caps,
'getNumaTopology',
lambda: {'0': {'cpus': [0, 1, 2, 3],
@@ -98,7 +70,7 @@
'memory': '1024',
'nodeIndex': 1}]}
with fake.VM(VM_PARAMS) as testvm:
- testvm._vmStats = FakeVmStatsThread(testvm)
+ testvm._vmStats = fake.VmStatsThread(testvm)
expectedResult = {'0': [0, 1], '1': [0, 1]}
vmNumaNodeRuntimeMap = numaUtils.getVmNumaNodeRuntimeInfo(testvm)
self.assertEqual(expectedResult, vmNumaNodeRuntimeMap)
diff --git a/tests/vmfakelib.py b/tests/vmfakelib.py
index 4b4bbd9..200a2ab 100644
--- a/tests/vmfakelib.py
+++ b/tests/vmfakelib.py
@@ -139,3 +139,31 @@
if status is not None:
fake._lastStatus = status
yield fake
+
+
+class SuperVdsm:
+ def __init__(self):
+ pass
+
+ def getProxy(self):
+ return self
+
+ def getVcpuNumaMemoryMapping(self, vmName):
+ return {0: [0, 1], 1: [0, 1], 2: [0, 1], 3: [0, 1]}
+
+
+class AdvancedStatsFunction:
+ def __init__(self):
+ pass
+
+ def getStats(self):
+ return [], [(0, 1, 19590000000L, 1),
+ (1, 1, 10710000000L, 1),
+ (2, 1, 19590000000L, 0),
+ (3, 1, 19590000000L, 2)], 15
+
+
+class VmStatsThread:
+ def __init__(self, vm):
+ self._vm = vm
+ self.sampleVcpuPinning = AdvancedStatsFunction()
--
To view, visit http://gerrit.ovirt.org/32821
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib2f844a6586eca567fede25b193a762318badd9f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani at redhat.com>
More information about the vdsm-patches
mailing list