💋 Sync 2026-10-11 00:16:14
Merge-upstream / merge (push) Canceled after 0s

This commit is contained in:
github-actions[bot] committed 2026-10-11 00:16:14 +08:00
1 parent c7bafc635d
commit c71da84035
264 files changed
+8169 -3944

No files matched your search

+14
View File
@@ -2,6 +2,7 @@
let core = require('core');
let ubus = require('ubus');
let fs = require('fs');
let runtime = require('runtime');
ubus.state.services.safeshield = {
@@ -10,6 +11,7 @@ ubus.state.services.safeshield = {
stopped: { running: false }
}
};
assert(runtime.service_status('safeshield', false).state == 'running', 'runtime distinguishes running services');
assert(runtime.service_running('safeshield') == true, 'service_running accepts any running instance');
assert(runtime.service_instance_running('safeshield', 'refreshd') == true, 'service_instance_running finds a running instance');
assert(runtime.service_instance_running('safeshield', 'stopped') == false, 'service_instance_running preserves stopped state');
@@ -20,6 +22,18 @@ ubus.state.services.dnsmasq = { instances: { main: { running: true } } };
assert(runtime.dnsmasq_running() == true, 'dnsmasq_running accepts a running dnsmasq instance');
ubus.state.services.dnsmasq.instances.main.running = false;
assert(runtime.dnsmasq_running() == false, 'dnsmasq_running rejects stopped dnsmasq instances');
assert(length(fs.state.calls) == 6, 'supported service checks use a separate bounded ubus client while unsupported names are rejected locally');
for (let call in fs.state.calls) {
assert(index(call, 'ubus -t 2 call service list') >= 0, 'service lookup uses ubus built-in timeout without an external timeout binary');
}
fs.state.timeout = true;
assert(runtime.service_running('safeshield') == false, 'failed or timed out service lookup fails closed');
assert(runtime.service_status('safeshield', true).state == 'unknown', 'lookup failure is exposed as unknown');
fs.state.timeout = false;
let calls_before = length(fs.state.calls);
assert(runtime.service_status('safeshield', true).lookup_ok == true, 'failed lookups are not cached');
assert(runtime.service_status('safeshield', true).lookup_ok == true, 'successful lookup can be reused briefly');
assert(length(fs.state.calls) == calls_before + 1, 'repeated successful lookups share the cached result');
let action = runtime.run_service_action('status', 1000);
assert(action.ok == true && action.rc == 0, 'run_service_action reports successful service commands');