From 3e3fe8d26ae203414da821f51c66b965b48d9870 Mon Sep 17 00:00:00 2001 From: hamistao Date: Fri, 5 Jul 2024 16:27:57 -0300 Subject: [PATCH] integration/test_storage: Support LXD 4.0 API on tests In LXD 4.0, responses from `/1.0/storage-pools/default/volumes/custom/vol/snapshots?recursion=1` included a null `expires_at` field. So this sets those fields manually to not break the checks. Signed-off-by: hamistao --- integration/test_storage.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/integration/test_storage.py b/integration/test_storage.py index 50e4f123..65054e00 100644 --- a/integration/test_storage.py +++ b/integration/test_storage.py @@ -193,6 +193,11 @@ def test_create_get_restore_delete_volume_snapshot(self): # Test getting all snapshots with recursion all_snapshots = volume.snapshots.all(use_recursion=True) + # Reponses from /1.0/storage-pools/default/volumes/custom/vol/snapshots?recursion=1 in LXD 4.0 has expires_at field as null. + # Setting expires_at manually to avoid breaking next checks. + if all_snapshots[0].expires_at is None: + all_snapshots[0].expires_at = "0001-01-01T00:00:00Z" + all_snapshots[1].expires_at = "2183-06-16T00:00:00Z" self.assertEqual(first_snapshot, all_snapshots[0]) self.assertEqual(custom_snapshot, all_snapshots[1])