Skip to content

Commit

Permalink
test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ycoheNvidia committed Feb 23, 2023
1 parent 21693d5 commit ed0078e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 3 additions & 3 deletions sonic_installer/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,9 +586,9 @@ def install(url, force, skip_platform_check=False, skip_migration=False, skip_pa
else:
echo_and_log('Verification successful')
except AttributeError:
echo_and_log("Skip Verifing image {} signature,".format(binary_image_version) +
"method not implemented for the current bootloader type: {}".format(bootloader.__class__.__name__))
pass
echo_and_log("Skip Verifing image {} signature,".format(binary_image_version) +
" method not implemented for the current bootloader type: {}".format(bootloader.__class__.__name__))
pass

echo_and_log("Installing image {} and setting it as default...".format(binary_image_version))
with SWAPAllocator(not skip_setup_swap, swap_mem_size, total_mem_threshold, available_mem_threshold):
Expand Down
7 changes: 6 additions & 1 deletion tests/test_sonic_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def rootfs_path_mock(path):
result = runner.invoke(sonic_installer.commands["install"], [sonic_image_filename, "-y"])
print(result.output)

assert result.exit_code == 0
assert result.exit_code != 0
# Assert bootloader install API was called
mock_bootloader.install_image.assert_called_with(f"./{sonic_image_filename}")
# Assert all below commands were called, so we ensure that
Expand Down Expand Up @@ -96,6 +96,11 @@ def rootfs_path_mock(path):
call(["umount", "-f", "-R", mounted_image_folder], raise_exception=False),
call(["umount", "-r", "-f", mounted_image_folder], raise_exception=False),
call(["rm", "-rf", mounted_image_folder], raise_exception=False),
call(['mkdir', '-p', mounted_image_folder]),
call(["mount", "-t", "squashfs", mounted_image_folder, mounted_image_folder]),
call(["sonic-cfggen", "-d", "-y", f"{mounted_image_folder}/etc/sonic/sonic_version.yml", "-t", f"{mounted_image_folder}/usr/share/sonic/templates/sonic-environment.j2"]),
call(["umount", "-r", "-f", mounted_image_folder], raise_exception=True),
call(["rm", "-rf", mounted_image_folder], raise_exception=True),
]
assert run_command_or_raise.call_args_list == expected_call_list

Expand Down

0 comments on commit ed0078e

Please sign in to comment.