fix: address follow-up review feedback

This commit is contained in:
2026-05-17 19:05:28 -07:00
parent c369841827
commit 10d9c38037
19 changed files with 191 additions and 38 deletions
+29
View File
@@ -108,6 +108,13 @@ local function run_plugin_scenario(config)
return
end
end
for _, value in ipairs(args) do
if value == "--stop" and config.stop_command_fails then
local stderr = config.stop_command_stderr or "stop failed"
callback(false, { status = 1, stdout = "", stderr = stderr }, stderr)
return
end
end
callback(true, { status = 0, stdout = "", stderr = "" }, nil)
end
end
@@ -593,6 +600,28 @@ do
)
end
do
local recorded, err = run_plugin_scenario({
process_list = "",
stop_command_fails = true,
stop_command_stderr = "stop refused",
option_overrides = {
binary_path = binary_path,
},
files = {
[binary_path] = true,
},
})
assert_true(recorded ~= nil, "plugin failed to load for failed restart-stop scenario: " .. tostring(err))
recorded.script_messages["subminer-restart"]()
assert_true(find_control_call(recorded.async_calls, "--stop") ~= nil, "restart should attempt stop")
assert_true(count_start_calls(recorded.async_calls) == 0, "restart should not start overlay when stop fails")
assert_true(
has_osd_message(recorded.osd, "SubMiner: Restart failed"),
"restart stop failure should show failure OSD"
)
end
do
local recorded, err = run_plugin_scenario({
process_list = "",