Update tests/load_test.lua
This commit is contained in:
@@ -240,4 +240,58 @@ end
|
|||||||
local function run_all_tests()
|
local function run_all_tests()
|
||||||
print("🚀 STARTING FULL TEST SUITE\n")
|
print("🚀 STARTING FULL TEST SUITE\n")
|
||||||
|
|
||||||
|
local test_modules = {
|
||||||
|
{name = "AUTOSCALING", path = "autoscaling_test.lua"},
|
||||||
|
{name = "BACKPRESSURE", path = "backpressure_test.lua"},
|
||||||
|
{name = "RUNTIME_LIMITS", path = "runtime_limits_test.lua"},
|
||||||
|
{name = "BACKUP", path = "backup_test.lua"},
|
||||||
|
{name = "SCHEMA_MIGRATION", path = "schema_migration_test.lua"},
|
||||||
|
{name = "LOAD_TEST", path = nil, fn = run_load_test}
|
||||||
|
}
|
||||||
|
|
||||||
|
local results = {}
|
||||||
|
|
||||||
|
for _, module in ipairs(test_modules) do
|
||||||
|
print("\n" .. string.rep("=", 70))
|
||||||
|
print(string.format("▶️ RUNNING %s TESTS", module.name))
|
||||||
|
print(string.rep("=", 70))
|
||||||
|
|
||||||
|
local result
|
||||||
|
if module.fn then
|
||||||
|
result = module.fn()
|
||||||
|
else
|
||||||
|
-- Загружаем и выполняем тестовый модуль
|
||||||
|
local chunk, err = loadfile(module.path)
|
||||||
|
if chunk then
|
||||||
|
local test_fn = chunk()
|
||||||
|
result = test_fn()
|
||||||
|
else
|
||||||
|
print("❌ Failed to load test module: " .. tostring(err))
|
||||||
|
result = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
table.insert(results, {name = module.name, passed = result})
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Итоговый отчёт
|
||||||
|
print("\n" .. string.rep("=", 70))
|
||||||
|
print("🏁 FINAL TEST SUMMARY")
|
||||||
|
print(string.rep("=", 70))
|
||||||
|
|
||||||
|
local passed_count = 0
|
||||||
|
for _, result in ipairs(results) do
|
||||||
|
local status = result.passed and "✅ PASSED" or "❌ FAILED"
|
||||||
|
print(string.format(" %-20s: %s", result.name, status))
|
||||||
|
if result.passed then passed_count = passed_count + 1 end
|
||||||
|
end
|
||||||
|
|
||||||
|
print(string.rep("-", 70))
|
||||||
|
print(string.format(" TOTAL: %d/%d tests passed", passed_count, #results))
|
||||||
|
print(string.rep("=", 70))
|
||||||
|
|
||||||
|
return passed_count == #results
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Запуск
|
||||||
|
return run_all_tests()
|
||||||
Reference in New Issue
Block a user