mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-10 18:05:44 +02:00
fix(pytest): call stop for all instances even if stop raise exception (#4339)
Signed-off-by: adi_holden <adi@dragonflydb.io>
This commit is contained in:
parent
682a3f6b15
commit
3f68028c08
1 changed files with 11 additions and 1 deletions
|
@ -453,9 +453,19 @@ class DflyInstanceFactory:
|
|||
|
||||
async def stop_all(self):
|
||||
"""Stop all launched instances."""
|
||||
exceptions = [] # To collect exceptions
|
||||
for instance in self.instances:
|
||||
await instance.close_clients()
|
||||
instance.stop()
|
||||
try:
|
||||
instance.stop()
|
||||
except Exception as e:
|
||||
exceptions.append(e) # Collect the exception
|
||||
if exceptions:
|
||||
first_exception = exceptions[0]
|
||||
raise Exception(
|
||||
f"One or more errors occurred while stopping instances. "
|
||||
f"First exception: {first_exception}"
|
||||
) from first_exception
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return f"Factory({self.args})"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue