Skip to content

Commit

Permalink
Fix verify_bash_history_is_empty when .bash_history doesn't exist.
Browse files Browse the repository at this point in the history
  • Loading branch information
LiliDeng authored and squirrelsc committed Feb 22, 2022
1 parent ec92914 commit a65d43b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions microsoft/testsuites/core/azure_image_standard.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,10 +582,11 @@ def verify_serial_console_is_enabled(self, node: Node) -> None:
use_new_environment=True,
)
def verify_bash_history_is_empty(self, node: Node) -> None:
cat = node.tools[Cat]
path_bash_history = node.get_pure_path("/root/.bash_history")
if path_bash_history:
bash_history = cat.read(str(path_bash_history), sudo=True)
path_bash_history = "/root/.bash_history"
cmd_result = node.execute(f"ls -lt {path_bash_history}", sudo=True, shell=True)
if 0 == cmd_result.exit_code:
cat = node.tools[Cat]
bash_history = cat.read(path_bash_history, sudo=True)
assert_that(bash_history).described_as(
"/root/.bash_history is not empty, this image is not prepared well."
).is_empty()

0 comments on commit a65d43b

Please sign in to comment.