Skip to content

Commit

Permalink
process pbm response
Browse files Browse the repository at this point in the history
  • Loading branch information
MiaAltieri committed Sep 1, 2023
1 parent b4fbfce commit 51e8557
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1003,7 +1003,8 @@ def run_pbm_command(self, cmd: List[str]) -> str:
Raises:
subprocess.CalledProcessError
"""
return subprocess.check_output(f"charmed-mongodb.pbm {' '.join(cmd)}", shell=True)
pbm_response = subprocess.check_output(f"charmed-mongodb.pbm {' '.join(cmd)}", shell=True)
return pbm_response.decode("utf-8")

def start_backup_service(self) -> None:
"""Starts the pbm agent.
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/backup_tests/test_backups.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ async def test_create_and_list_backups(ops_test: OpsTest) -> None:
# verify backup is started
action = await db_unit.run_action(action_name="create-backup")
backup_result = await action.wait()
assert backup_result.results["backup-status"] == "backup started", "backup didn't start"
assert "backup started" in backup_result.results["backup-status"], "backup didn't start"

# verify backup is present in the list of backups
# the action `create-backup` only confirms that the command was sent to the `pbm`. Creating a
Expand Down Expand Up @@ -401,4 +401,4 @@ async def test_update_backup_password(ops_test: OpsTest) -> None:
# verify we still have connection to pbm via creating a backup
action = await db_unit.run_action(action_name="create-backup")
backup_result = await action.wait()
assert backup_result.results["backup-status"] == "backup started", "backup didn't start"
assert "backup started" in backup_result.results["backup-status"], "backup didn't start"

0 comments on commit 51e8557

Please sign in to comment.