J.A.R.V.I.S-rust/resources/commands/self_check/smoke.lua
Bossiara13 ea4341fbc9 test+feat: +3 commands tests, +2 packs (self_check + ssl_check), env-race fix
Tests (112→115, +3)
  - commands::additional_tests::no_duplicate_command_ids_across_packs
    Catches accidental ID collisions across packs at PR time, with informative
    error pointing to both offending packs.
  - commands::additional_tests::no_empty_phrases_for_any_language
    Empty phrase strings would silently break voice matching; this rejects them.
  - commands::additional_tests::all_lua_packs_reference_existing_scripts
    Existing test of similar shape used path globbing; this version uses the
    parsed cmd.script field for a more precise error message.

Plus: runtime_config tests no longer race on shared env vars. Consolidated
parallel test bodies into single fn each with a Mutex guard. 5 tests → 3 tests
but each covers more states (default + custom + garbage in one body).

New packs

resources/commands/self_check/ (2 cmds)
  - selfcheck.ping   "ты тут" / "ты слышишь" / "пинг" / "ты живой"
                     Random pick from 5 short canned replies — no LLM call,
                     no network. Pure mic-chain + TTS smoke test.
  - selfcheck.smoke  "проверь себя" / "самопроверка"
                     Reads jarvis.health() + tries one HTTP request,
                     speaks list of "X работает, Y работает...".

resources/commands/ssl_check/ (1 cmd)
  - ssl.check  "проверь сертификат example.com"
               PowerShell TCP+SslStream→X509Certificate2. Reports days
               until expiry, expiry date, issuer CN. Adds urgency prefix
               ("СКОРО!" if <7 days, "Скоро." if <30, "просрочен!" if past).

Pack count: 70 → 72. Tests: 115/115 + 1 ignored Ollama smoke.
Build: cargo build --release -p jarvis-app green.
2026-05-15 23:43:59 +03:00

46 lines
1.3 KiB
Lua
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- Smoke test: verify every major subsystem responds.
-- Useful for "is the install OK" after fresh setup.
local h = jarvis.health()
local checks = {}
-- 1. TTS configured
if h.tts_backend and h.tts_backend ~= "" then
table.insert(checks, "TTS " .. h.tts_backend .. " активен")
end
-- 2. LLM configured
if h.llm_backend and h.llm_backend ~= "none" then
table.insert(checks, "LLM " .. h.llm_backend .. " подключён")
else
table.insert(checks, "ВНИМАНИЕ: LLM не настроен")
end
-- 3. Memory + scheduler files exist
if h.memory_facts ~= nil then
table.insert(checks, "хранилище памяти работает")
end
if h.scheduled_tasks ~= nil then
table.insert(checks, "планировщик работает")
end
-- 4. Profile + i18n
if h.active_profile then
table.insert(checks, "профиль " .. h.active_profile)
end
-- 5. Quick HTTP smoke
local r = pcall(function()
local resp = jarvis.http.get("https://api.ipify.org")
return resp and resp.ok
end)
if r then
table.insert(checks, "интернет есть")
end
if #checks == 0 then
return jarvis.cmd.error("Все системы молчат — что-то не так.")
end
local line = "Самопроверка: " .. table.concat(checks, ", ") .. "."
return jarvis.cmd.ok(line)