Skip to content

Commit 553ea74

Browse files
committed
TST: make test_take_snapshot_add_01 more robust
1 parent 7bb98a8 commit 553ea74

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

tests/test_snapshot_control.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -257,11 +257,13 @@ def test_take_snapshot_add_01(clear_sar, library, usesetauth): # noqa: F811
257257
response = SR.node_get_children(config_uid)
258258
assert len(response) == 2
259259

260-
# Get all the snapshots in the database (now there are only two)
260+
# Get all the snapshots in the database (we created only two)
261+
# We use only one directory node for the tests. There could be other
262+
# snapshots in the database and they should not affect the test.
261263
response = SR.snapshots_get()
262-
assert len(response) == 2
264+
assert len(response) >= 2
263265
uids = [_["uniqueId"] for _ in response]
264-
assert set(uids) == {shot_uid_1, shot_uid_2}
266+
assert {shot_uid_1, shot_uid_2}.issubset(set(uids))
265267

266268
else:
267269
async def testing():
@@ -316,10 +318,12 @@ async def testing():
316318
response = await SR.node_get_children(config_uid)
317319
assert len(response) == 2
318320

319-
# Get all the snapshots in the database (now there are only two)
321+
# Get all the snapshots in the database (we created only two)
322+
# We use only one directory node for the tests. There could be other
323+
# snapshots in the database and they should not affect the test.
320324
response = await SR.snapshots_get()
321-
assert len(response) == 2
325+
assert len(response) >= 2
322326
uids = [_["uniqueId"] for _ in response]
323-
assert set(uids) == {shot_uid_1, shot_uid_2}
327+
assert {shot_uid_1, shot_uid_2}.issubset(set(uids))
324328

325329
asyncio.run(testing())

0 commit comments

Comments
 (0)