summaryrefslogtreecommitdiff
path: root/nova/tests/unit/objects
diff options
context:
space:
mode:
authorStephen Finucane <stephenfin@redhat.com>2021-02-12 15:53:46 +0000
committerStephen Finucane <stephenfin@redhat.com>2021-02-20 15:32:15 +0000
commitf7e3e179911e0a7fbad0d108c202c475560dbcea (patch)
tree9a03d8d20747b5593ea629f320489451903d7d99 /nova/tests/unit/objects
parentb367cf114cdf825c83ada213233133362a6e5acf (diff)
downloadnova-f7e3e179911e0a7fbad0d108c202c475560dbcea.tar.gz
tests: Poison os.uname
We shouldn't be looking up the architecture of the test node during tests to ensure tests work across nodes with varying architectures. Change-Id: I458b1db091e33c0b835e44b5a86de6c0a08f99a3 Signed-off-by: Stephen Finucane <stephenfin@redhat.com> Co-authored-by: Lee Yarwood <lyarwood@redhat.com>
Diffstat (limited to 'nova/tests/unit/objects')
-rw-r--r--nova/tests/unit/objects/test_fields.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/nova/tests/unit/objects/test_fields.py b/nova/tests/unit/objects/test_fields.py
index 47af33f653..39f9de8cfe 100644
--- a/nova/tests/unit/objects/test_fields.py
+++ b/nova/tests/unit/objects/test_fields.py
@@ -12,6 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
+import collections
import datetime
import os
@@ -27,6 +28,10 @@ from nova import test
from nova.tests.unit import fake_instance
from nova import utils
+os_uname = collections.namedtuple(
+ 'uname_result', ['sysname', 'nodename', 'release', 'version', 'machine'],
+)
+
class FakeFieldType(fields.FieldType):
def coerce(self, obj, attr, value):
@@ -187,7 +192,7 @@ class TestEnum(TestField):
class TestArchitecture(TestField):
@mock.patch.object(os, 'uname')
def test_host(self, mock_uname):
- mock_uname.return_value = (
+ mock_uname.return_value = os_uname(
'Linux',
'localhost.localdomain',
'3.14.8-200.fc20.x86_64',