Test if a snapshot name already exists

This fix random test failure when testing snapshots. It
seem under high load sometimes the previous snapshot folder
was not visible on disk. Perhaps a test isolation issue but
I don't see how.

But in any case it's better to test if the name is not already
use.

Fix #1118
This commit is contained in:
Julien Duponchelle committed 2017-07-11 15:28:01 +02:00
1 parent d17b4eb053
commit 450c089b6d
1 file changed
+3
+3
View File
@@ -510,6 +510,9 @@ class Project:
:param name: Name of the snapshot
"""
if name in [snap.name for snap in self.snapshots.values()]:
raise aiohttp.web_exceptions.HTTPConflict(text="The snapshot {} already exist".format(name))
snapshot = Snapshot(self, name=name)
try:
if os.path.exists(snapshot.path):