From cb66508e191d53206baa96db4f7d9d82a3c0357f Mon Sep 17 00:00:00 2001 From: Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com> Date: Wed, 2 Oct 2024 12:36:45 +0200 Subject: [PATCH] refactor(base.lua): improve test completion logic Refactored the test completion logic in the `run_tests` function for better readability and maintainability. Removed redundant check for `minetest.settings:get_bool("test_harness_stop_server", true)` and streamlined the conditional flow based on `tests_state`. This change enhances code clarity without altering functionality significantly. --- .util/docker-compose.yaml | 2 +- base.lua | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.util/docker-compose.yaml b/.util/docker-compose.yaml index c762faf..0f51262 100644 --- a/.util/docker-compose.yaml +++ b/.util/docker-compose.yaml @@ -1,7 +1,7 @@ version: "3.2" services: server: - restart: no + restart: "no" build: dockerfile: Dockerfile ports: diff --git a/base.lua b/base.lua index 80ff6e8..72f659e 100644 --- a/base.lua +++ b/base.lua @@ -554,11 +554,9 @@ local run_tests = function() end print("Server tests done, " .. failed .. " tests failed.") - if minetest.settings:get_bool("test_harness_stop_server", true) and ( next(players_tests) == nil or tests_state == TESTS_STATE_ENUM.DONE) then - request_shutdown() - end - if tests_state == TESTS_STATE_ENUM.DONE then + if next(players_tests) == nil or tests_state == TESTS_STATE_ENUM.DONE then + set_tests_done() return end