Blob Blame History Raw
From a709c4db1bcf2e7ff69158a54ed3a1ea92ba4f97 Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Thu, 14 Oct 2021 08:48:05 +0200
Subject: [PATCH] tests: Mark "fake" disks in test_get_related_disks as
 non-existing

We are using "real" disk names ("sda", "sdb"...) in this test so
we need to avoid reading their real sizes which we do for existing
devices using os.stat. The test can fail if we have a disk with
the same name and small (or zero) size.

Resolves: rhbz#2062690
---
 tests/devicetree_test.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/devicetree_test.py b/tests/devicetree_test.py
index 3be4d572..c1b97c52 100644
--- a/tests/devicetree_test.py
+++ b/tests/devicetree_test.py
@@ -406,9 +406,9 @@ class DeviceTreeTestCase(unittest.TestCase):
     def test_get_related_disks(self):
         tree = DeviceTree()
 
-        sda = DiskDevice("sda", size=Size('300g'))
-        sdb = DiskDevice("sdb", size=Size('300g'))
-        sdc = DiskDevice("sdc", size=Size('300G'))
+        sda = DiskDevice("sda", size=Size('300g'), exists=False)
+        sdb = DiskDevice("sdb", size=Size('300g'), exists=False)
+        sdc = DiskDevice("sdc", size=Size('300G'), exists=False)
 
         tree._add_device(sda)
         tree._add_device(sdb)
-- 
2.34.3