Skip to content

Commit

Permalink
[pytest]: Check if appl DB exists before deleting (#1983)
Browse files Browse the repository at this point in the history
*Add a new helper method for deleting appl DBs, and use it anytime appl DB needs to be deleted
Signed-off-by: Lawrence Lee <[email protected]>
  • Loading branch information
theasianpianist authored Oct 27, 2021
1 parent 553d75a commit da8a43e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,10 +410,15 @@ def reset_dbs(self):
self.flex_db = None
self.state_db = None

def destroy(self) -> None:
def del_appl_db(self):
# APPL DB may not always exist, so use this helper method to check before deleting
if getattr(self, 'appldb', False):
del self.appldb


def destroy(self) -> None:
self.del_appl_db()

# In case persistent dvs was used removed all the extra server link
# that were created
if self.persistent:
Expand Down Expand Up @@ -583,8 +588,7 @@ def ctn_restart(self) -> None:
self.ctn.restart()

def restart(self) -> None:
if self.appldb:
del self.appldb
self.del_appl_db()

self.ctn_restart()
self.check_ready_status_and_init_db()
Expand Down

0 comments on commit da8a43e

Please sign in to comment.