Skip to content

Commit

Permalink
Attempt to fix HA tests
Browse files Browse the repository at this point in the history
  • Loading branch information
juditnovak committed Jul 21, 2023
1 parent 6bb68a1 commit 65c790e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions tests/integration/ha_tests/application_charm/src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

DATABASE_NAME = "continuous_writes_database"
PEER = "application-peers"
LAST_WRITTEN_FILE = "/tmp/last_written_value"
LAST_WRITTEN_FILE = "last_written_value"
PROC_PID_KEY = "proc-pid"


Expand Down Expand Up @@ -124,7 +124,10 @@ def _stop_continuous_writes(self) -> Optional[int]:
return None

# Send a SIGTERM to the process and wait for the process to exit
os.kill(int(self.app_peer_data[PROC_PID_KEY]), signal.SIGTERM)
try:
os.kill(int(self.app_peer_data[PROC_PID_KEY]), signal.SIGTERM)
except ProcessLookupError:
logger.info(f"Process {PROC_PID_KEY} was killed already (or never existed)")

del self.app_peer_data[PROC_PID_KEY]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def continous_writes(connection_string: str, starting_number: int):

write_value += 1

with open("/tmp/last_written_value", "w") as fd:
with open("last_written_value", "w") as fd:
fd.write(str(write_value - 1))


Expand Down

0 comments on commit 65c790e

Please sign in to comment.