Skip to content

Commit

Permalink
integration/test_storage: Support LXD 4.0 API on tests
Browse files Browse the repository at this point in the history
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 <pedro.ribeiro@canonical.com>
  • Loading branch information
hamistao committed Jul 5, 2024
1 parent 7a776a9 commit f6a01d2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions integration/test_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 later checks.
if all_snapshots[0]["expires_at"] == None:
all_snapshots[0].expires_at = "0001-01-01T00:00:00Z"
all_snapshots[1].expires_at = "2183-06-16T00:00:00Z"
self.assertEquals(first_snapshot, all_snapshots[0])
self.assertEquals(custom_snapshot, all_snapshots[1])

Expand Down

0 comments on commit f6a01d2

Please sign in to comment.