]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
tests: correct to check blkdev for NS attached
authorTokunori Ikegami <ikegami.t@gmail.com>
Thu, 23 Jan 2025 15:40:49 +0000 (00:40 +0900)
committerDaniel Wagner <wagi@monom.org>
Mon, 27 Jan 2025 08:48:17 +0000 (09:48 +0100)
Since currently only default NS blkdev checked for all NSs.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
tests/nvme_test.py

index 863fc023d445670fd1eec096c7c5164eb9f01ca5..66e8edfb2b45978ef960d11caf65778e63c663c1 100644 (file)
@@ -394,7 +394,7 @@ class TestNVMe(unittest.TestCase):
                                   stdout=subprocess.DEVNULL)
         return err
 
-    def attach_ns(self, ctrl_id, ns_id):
+    def attach_ns(self, ctrl_id, nsid):
         """ Wrapper for attaching the namespace.
             - Args:
                 - ctrl_id : controller id to which namespace to be attached.
@@ -403,7 +403,7 @@ class TestNVMe(unittest.TestCase):
                 - 0 on success, error code on failure.
         """
         attach_ns_cmd = f"{self.nvme_bin} attach-ns {self.ctrl} " + \
-            f"--namespace-id={str(ns_id)} --controllers={ctrl_id}"
+            f"--namespace-id={str(nsid)} --controllers={ctrl_id}"
         err = subprocess.call(attach_ns_cmd,
                               shell=True,
                               stdout=subprocess.DEVNULL)
@@ -411,7 +411,7 @@ class TestNVMe(unittest.TestCase):
             # enumerate new namespace block device
             self.nvme_reset_ctrl()
             # check if new namespace block device exists
-            err = 0 if stat.S_ISBLK(os.stat(self.ns1).st_mode) else 1
+            err = 0 if stat.S_ISBLK(os.stat(self.ctrl + "n"  + str(nsid)).st_mode) else 1
         return err
 
     def detach_ns(self, ctrl_id, nsid):