From d1802b938279315de84d7dd90950ee1f0914e31a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 21 Apr 2026 20:10:26 +0000 Subject: [PATCH 1/2] Initial plan From 6d4c115ea018b68277e737f70c02466b77ab9ae8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 21 Apr 2026 20:13:40 +0000 Subject: [PATCH 2/2] Add tests for snap-preseed-channel and snap-preseed-validation options Agent-Logs-Url: https://github.com/canonical/imagecraft/sessions/34e3782d-fe61-42fb-8630-aac0f0238e49 Co-authored-by: lengau <4305943+lengau@users.noreply.github.com> --- .../unit/plugins/test_snap_preseed_plugin.py | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tests/unit/plugins/test_snap_preseed_plugin.py b/tests/unit/plugins/test_snap_preseed_plugin.py index ebfcfe58..18ce4ea4 100644 --- a/tests/unit/plugins/test_snap_preseed_plugin.py +++ b/tests/unit/plugins/test_snap_preseed_plugin.py @@ -100,3 +100,35 @@ def test_get_build_commands_with_revisions(part_info, cmd_prefix): plugin.get_build_commands()[0] == f'{cmd_prefix} --revisions=./revisions.txt --snap=core24 "" {part_info.part_install_dir}' ) + + +def test_get_build_commands_with_channel(part_info, cmd_prefix): + properties = SnapPreseedPluginProperties.unmarshal( + { + "snap-preseed-snaps": ["core24"], + "snap-preseed-channel": "latest/stable", + } + ) + + plugin = SnapPreseedPlugin(properties=properties, part_info=part_info) + + assert ( + plugin.get_build_commands()[0] + == f'{cmd_prefix} --channel=latest/stable --snap=core24 "" {part_info.part_install_dir}' + ) + + +def test_get_build_commands_with_validation_enforce(part_info): + properties = SnapPreseedPluginProperties.unmarshal( + { + "snap-preseed-snaps": ["core24"], + "snap-preseed-validation": "enforce", + } + ) + + plugin = SnapPreseedPlugin(properties=properties, part_info=part_info) + + assert ( + plugin.get_build_commands()[0] + == f'snap prepare-image --classic --arch={part_info.target_arch} --validation=enforce --snap=core24 "" {part_info.part_install_dir}' + )