diff mbox

[5/5] libbtrfsutil: fix test assumptions about top-level subvolume

Message ID 459ffd8130e337e16fc2205584ee27883e959442.1522309741.git.osandov@fb.com (mailing list archive)
State New, archived
Headers show

Commit Message

Omar Sandoval March 29, 2018, 7:53 a.m. UTC
From: Omar Sandoval <osandov@fb.com>

Since "btrfs-progs: mkfs: add uuid and otime to ROOT_ITEM of, FS_TREE",
the top-level subvolume has a non-zero UUID, ctime, and otime. Fix the
subvolume_info() test to not check for zero.

Signed-off-by: Omar Sandoval <osandov@fb.com>
---
 libbtrfsutil/python/tests/test_subvolume.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Misono Tomohiro March 30, 2018, 7:39 a.m. UTC | #1
On 2018/03/29 16:53, Omar Sandoval wrote:
> From: Omar Sandoval <osandov@fb.com>
> 
> Since "btrfs-progs: mkfs: add uuid and otime to ROOT_ITEM of, FS_TREE",
> the top-level subvolume has a non-zero UUID, ctime, and otime. Fix the
> subvolume_info() test to not check for zero.

Sorry, I didn't notice this.

I checked this works in devel branch:
Reviewed-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com>

> 
> Signed-off-by: Omar Sandoval <osandov@fb.com>
> ---
>  libbtrfsutil/python/tests/test_subvolume.py | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/libbtrfsutil/python/tests/test_subvolume.py b/libbtrfsutil/python/tests/test_subvolume.py
> index a46d4a34..93396cba 100644
> --- a/libbtrfsutil/python/tests/test_subvolume.py
> +++ b/libbtrfsutil/python/tests/test_subvolume.py
> @@ -95,7 +95,8 @@ class TestSubvolume(BtrfsTestCase):
>                  self.assertEqual(info.parent_id, 0)
>                  self.assertEqual(info.dir_id, 0)
>                  self.assertEqual(info.flags, 0)
> -                self.assertEqual(info.uuid, bytes(16))
> +                self.assertIsInstance(info.uuid, bytes)
> +                self.assertEqual(len(info.uuid), 16)
>                  self.assertEqual(info.parent_uuid, bytes(16))
>                  self.assertEqual(info.received_uuid, bytes(16))
>                  self.assertNotEqual(info.generation, 0)
> @@ -103,8 +104,8 @@ class TestSubvolume(BtrfsTestCase):
>                  self.assertEqual(info.otransid, 0)
>                  self.assertEqual(info.stransid, 0)
>                  self.assertEqual(info.rtransid, 0)
> -                self.assertEqual(info.ctime, 0)
> -                self.assertEqual(info.otime, 0)
> +                self.assertIsInstance(info.ctime, float)
> +                self.assertIsInstance(info.otime, float)>                  self.assertEqual(info.stime, 0)
>                  self.assertEqual(info.rtime, 0)
>  
> @@ -117,6 +118,7 @@ class TestSubvolume(BtrfsTestCase):
>          self.assertEqual(info.dir_id, 256)
>          self.assertEqual(info.flags, 0)
>          self.assertIsInstance(info.uuid, bytes)
> +        self.assertEqual(len(info.uuid), 16)
>          self.assertEqual(info.parent_uuid, bytes(16))
>          self.assertEqual(info.received_uuid, bytes(16))
>          self.assertNotEqual(info.generation, 0)
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/libbtrfsutil/python/tests/test_subvolume.py b/libbtrfsutil/python/tests/test_subvolume.py
index a46d4a34..93396cba 100644
--- a/libbtrfsutil/python/tests/test_subvolume.py
+++ b/libbtrfsutil/python/tests/test_subvolume.py
@@ -95,7 +95,8 @@  class TestSubvolume(BtrfsTestCase):
                 self.assertEqual(info.parent_id, 0)
                 self.assertEqual(info.dir_id, 0)
                 self.assertEqual(info.flags, 0)
-                self.assertEqual(info.uuid, bytes(16))
+                self.assertIsInstance(info.uuid, bytes)
+                self.assertEqual(len(info.uuid), 16)
                 self.assertEqual(info.parent_uuid, bytes(16))
                 self.assertEqual(info.received_uuid, bytes(16))
                 self.assertNotEqual(info.generation, 0)
@@ -103,8 +104,8 @@  class TestSubvolume(BtrfsTestCase):
                 self.assertEqual(info.otransid, 0)
                 self.assertEqual(info.stransid, 0)
                 self.assertEqual(info.rtransid, 0)
-                self.assertEqual(info.ctime, 0)
-                self.assertEqual(info.otime, 0)
+                self.assertIsInstance(info.ctime, float)
+                self.assertIsInstance(info.otime, float)
                 self.assertEqual(info.stime, 0)
                 self.assertEqual(info.rtime, 0)
 
@@ -117,6 +118,7 @@  class TestSubvolume(BtrfsTestCase):
         self.assertEqual(info.dir_id, 256)
         self.assertEqual(info.flags, 0)
         self.assertIsInstance(info.uuid, bytes)
+        self.assertEqual(len(info.uuid), 16)
         self.assertEqual(info.parent_uuid, bytes(16))
         self.assertEqual(info.received_uuid, bytes(16))
         self.assertNotEqual(info.generation, 0)