Testing the syslog module without URL argument.

-- Testcase --
{% include("./cmd/cmd.uc", { TRACE_CALLS: "stdout" }) %}
-- End --

-- Environment --
cmd={ "command": "upgrade", "payload": { } }
-- End --

-- File fs/stat~_etc_ucentral_cert_key.json --
{}
-- End --

-- File fs/stat~_etc_ucentral_cert_pem.json --
{}
-- End --

-- File fs/stat~_etc_ucentral_redirector_json.json --
{}
-- End --

-- File fs/stat~_etc_ucentral_dev-id.json --
{}
-- End --

-- Expect stdout --
[call] ubusconn.call object <ucentral> method <result> args <{ "status": { /* 2 keys */ } }>
-- End --

-- Expect stderr --
No firmware URL provided
-- End --


Testing the syslog module with URL argument.

-- Testcase --
{% include("./cmd/cmd.uc", { TRACE_CALLS: "stdout" }) %}
-- End --

-- Environment --
cmd={ "command": "upgrade", "payload": { "uri": "http://example.org/image.bin" } }
-- End --

-- Expect stdout --
[call] system command <[ "wget", "-O", "/tmp/ucentral.upgrade", "http://example.org/image.bin" ]> timeout <null>
[call] ubusconn.call object <system> method <validate_firmware_image> args <{ "path": "/tmp/ucentral.upgrade" }>
[call] fs.stat path </etc/ucentral/cert.key>
[call] fs.stat path </etc/ucentral/cert.pem>
[call] fs.stat path </etc/ucentral/redirector.json>
[call] fs.stat path </etc/ucentral/dev-id>
[call] system command <[ "tar", "czf", "/tmp/sysupgrade.tgz", "/etc/config/ucentral", "/etc/ucentral/cert.key", "/etc/ucentral/cert.pem", "/etc/ucentral/redirector.json", "/etc/ucentral/dev-id" ]> timeout <null>
[call] system command <[ "/etc/init.d/network", "stop" ]> timeout <null>
[call] system command <[ "sysupgrade", "/tmp/ucentral.upgrade" ]> timeout <null>
-- End --

-- Expect stderr --
Upgrading firmware
-- End --


Testing the syslog module with URL argument and configuration keeping.

-- Testcase --
{% include("./cmd/cmd.uc", { TRACE_CALLS: "stdout" }) %}
-- End --

-- Environment --
cmd={ "command": "upgrade", "payload": {"uri": "http://example.org/image.bin", "keep_redirector": true }}
-- End --

-- Expect stdout --
[call] system command <[ "wget", "-O", "/tmp/ucentral.upgrade", "http://example.org/image.bin" ]> timeout <null>
[call] ubusconn.call object <system> method <validate_firmware_image> args <{ "path": "/tmp/ucentral.upgrade" }>
[call] fs.stat path </etc/ucentral/cert.key>
[call] fs.stat path </etc/ucentral/cert.pem>
[call] fs.stat path </etc/ucentral/redirector.json>
[call] fs.stat path </etc/ucentral/dev-id>
[call] fs.readlink path </etc/ucentral/ucentral.active>
[call] system command <[ "tar", "czf", "/tmp/sysupgrade.tgz", "/etc/config/ucentral", "/etc/ucentral/cert.key", "/etc/ucentral/cert.pem", "/etc/ucentral/redirector.json", "/etc/ucentral/dev-id", "/etc/ucentral/ucentral.active", "/etc/ucentral/ucentral.active-link" ]> timeout <null>
[call] system command <[ "/etc/init.d/network", "stop" ]> timeout <null>
[call] system command <[ "sysupgrade", "-f", "/tmp/sysupgrade.tgz", "/tmp/ucentral.upgrade" ]> timeout <null>
-- End --

-- Expect stderr --
Upgrading firmware
-- End --
