46 Commits

Author SHA1 Message Date
Yves-Marie Haussonne
c80b57db06 chore(ci): Update scripts for better handling test cases and debugging
- Update .gitlab-ci.yml to use 'jq' in addition to 'bash' for improved functionality.
- Modify flags in .util/run_tests.sh
2024-10-10 15:33:48 +02:00
Yves-Marie Haussonne
18fdb914a5 chore(ci): Update command line arguments in .gitlab-ci.yml and fix naming convention in .mod_env.json
Refactored the test execution command in `.gitlab-ci.yml` to use double dashes for the `--docker` argument instead of a single dash. Also corrected the naming convention in `.mod_env.json` from `minetest-add-conf` to `minetest_add_conf`. The changes ensure consistency and clarity in configuration files.
2024-10-10 15:04:15 +02:00
Yves-Marie Haussonne
0a2e282dae chore(util): Refactor Docker-related scripts for better modularity
Refactored Docker-related scripts to improve modularity and readability. Introduced support for loading configuration from `.mod_env.json` files, enhancing script flexibility. Added debug flag to enable detailed logging during script execution for better troubleshooting. Fixed file path issues related to script operations.
2024-10-10 14:41:48 +02:00
Yves-Marie Haussonne
1d4681417a feat(tests): add option to specify client docker image
In the test script `run_tests.sh`, added `-i/--client-image` option to specify the client docker image used for tests. This allows flexibility in choosing different client images for testing purposes. The default client image is set to `registry.apps.education.fr/iri/minetest/docker_test_harness/client:latest`. Additionally, improved cleanup logic to handle scenarios when docker compose file and docker command are not present or empty.
2024-10-10 08:31:57 +02:00
Yves-Marie Haussonne
b77733ed70 feat(mod_env): introduce mod environment file
- Added `.mod_env` file to store environment configurations for mods.
- The file includes settings for `CURRENT_MOD`, `DEPENDENCIES`, and `CLIENT_NB`.
- Modifications across various files to incorporate and reference values from `.mod_env`.
- Docker-related scripts updated to utilize variables from `.mod_env`.
2024-10-10 01:19:06 +02:00
Yves-Marie Haussonne
ae9daa881b chore(tests): update test setup instructions
Provide detailed setup steps for running tests in the project, including adjusting the `docker-compose.yaml` file to specify client instances and their players.
2024-10-07 15:14:14 +02:00
Yves-Marie Haussonne
d97e252372 chore(base): refactor variable names for clarity
Refactored loops to correctly count the number of mods in `tests_mod_list`.
2024-10-06 10:31:07 +02:00
Yves-Marie Haussonne
f8dbd2360a debug 2024-10-06 10:13:27 +02:00
Yves-Marie Haussonne
861f71da9d refactor(base): rename register_test to register_test_template
Renamed `register_test` to `register_test_template` for clarity and consistency with its purpose of defining a test template in the base.lua file.
2024-10-06 09:35:03 +02:00
Yves-Marie Haussonne
8de4cc3964 feat(tests): enhance test framework for minetest mods
- Enhance instructions in the README for setting up and running tests with the test framework.
- Develop modules for registering and running tests within mods.
- Provide a mechanism to control which mods are tested through `test_harness_mods` setting.
- Improve summary display logic for test results and categorize them (passed, failed, skipped, dnr).
- Refactor scripts for better management of test execution and handling various cases.
2024-10-06 09:19:43 +02:00
Yves-Marie Haussonne
b322a1b6b1 fix(base.lua): fix 'skip' status in test result output
Corrected the displayed status of skipped tests from 'skip' to 'dnr' (short for 'did not run'). This change ensures better clarity in the test summary by accurately reflecting the status of each test. The modification impacts the visual representation of skipped tests, enhancing the overall readability of the test results.
2024-10-04 15:45:46 +02:00
Yves-Marie Haussonne
ad261f3e41 chore(base.lua): refactor test result printing and cleanup
Refactor the code to extract the test result printing logic into a separate function, `print_result_line`, to improve readability and reduce code duplication. This change aims to enhance maintainability by consolidating similar print statements and ensuring consistent display of test results across the script.
2024-10-04 14:21:06 +02:00
Yves-Marie Haussonne
0fafeb9f52 refactor(test_harness): improve test handling and display
Refactored the `run_player_tests` function in `base.lua` to improve error handling and the way test results are displayed. Tests now run asynchronously and reschedule remaining tests if necessary. Added clearer output for skipped tests and improved failure reporting.
2024-10-04 12:13:59 +02:00
Yves-Marie Haussonne
e8235378d9 style(base.lua): enhance test summary display
Enhanced the display of test summaries in `base.lua` for better readability and alignment. Increased the width of formatted strings from 60 to 80 characters, providing a more spacious layout for test outputs
2024-10-04 01:36:49 +02:00
Yves-Marie Haussonne
8f77cd456c feat(colors): add color management for console output
Add color management functionality sourced from 'lua-chroma' library, introducing various color escape sequences for enhanced console output formatting. Implemented a `pprint` function for formatted printing with color support, enabling structured and visually enhanced display in the console for tests and results.

This commit enhances readability and visual differentiation in test summary displays through color-coded outputs, highlighting test status and errors effectively.
2024-10-04 01:29:54 +02:00
Yves-Marie Haussonne
f99c66daed spawn position seems to vary a bit 2024-10-03 16:53:19 +02:00
Riwad Salim
5d08b02283 Update README.md 2024-10-02 23:34:00 +00:00
Yves-Marie Haussonne
3bc13b5c9f feat[player]: Save and restore player inventories during test
Save complete players inventories, and added unit tests on players
2024-10-02 19:59:39 +02:00
Yves-Marie Haussonne
bbe0722e94 chore(ci): exclude unnecessary files from test harness archive
Adjusting tar command in GitLab CI to exclude `dist` directory from the test harness archive for more efficient packaging and deployment.
2024-10-02 13:15:46 +02:00
Yves-Marie Haussonne
0471a4b706 chore(ci): update build process artifact path
Reworked the build script to enhance artifact handling. Created a 'dist' directory, storing generated artifacts. Modified paths for cleaner output organization.
2024-10-02 13:05:49 +02:00
Yves-Marie Haussonne
cb66508e19 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.
2024-10-02 12:36:45 +02:00
Yves-Marie Haussonne
02f78d379b chore(ci): update packaging script output directory
Adjusted the packaging script in `.gitlab-ci.yml` to save artifacts in `/tmp/` for improved storage management and accessibility. Additionally, fixed a conditional statement in `base.lua` to properly handle the failfast option during testing.
2024-10-02 12:15:03 +02:00
Yves-Marie Haussonne
4475ebb556 debug 2024-10-02 11:31:19 +02:00
Yves-Marie Haussonne
514e089214 fix(tests): change 'break' to 'return' in run_tests
Changing 'break' to 'return' in the run_tests function to stop the test loop when a failure occurs, improving test harness behavior by returning from the function instead of breaking out of the loop.
2024-10-02 11:24:24 +02:00
Yves-Marie Haussonne
199abfba88 refactor(base.lua): improve run_tests function logic
Refactor the run_tests function in base.lua to enhance its logic and readability. The changes ensure proper handling of the tests_state enumeration.
2024-10-02 11:12:18 +02:00
Yves-Marie Haussonne
14860ab625 fix(testing): ensure mod validity in get_test_registrator
Check if the provided mod name is valid by iterating through the registered mod names before allowing test registration.
2024-10-02 08:07:56 +02:00
Yves-Marie Haussonne
b40bbafd4c feat(tests): introduce modular test registration
- Adds support for registering tests under specific modules to enhance organization and categorization.
- Introduces `register_test` function scoped within a module using `get_test_registrator`.
- Track tests by module for improved visibility and management.
- Enhances test output formatting to include module information alongside test names.
2024-10-02 01:42:45 +02:00
Yves-Marie Haussonne
6514938564 Add generic test harness lib. test itself 2024-10-01 19:00:24 +02:00
Yves-Marie Haussonne
3507711d04 chore(client): add wait for minetest process
Adding a wait statement for the termination of the Minetest process to ensure proper clean-up and graceful exit handling in the client's entrypoint script.
2024-10-01 02:05:14 +02:00
Yves-Marie Haussonne
269f250802 refactor(client): remove workaround for reviving died players
Removed a workaround in entrypoint.sh that revived died players periodically using xdotool key presses.
2024-10-01 01:35:35 +02:00
Yves-Marie Haussonne
edd234b5eb chore(client): update Dockerfile dependencies and entrypoint script
Adjust Dockerfile with additional development packages for libraries.  use xvfb-run instead of xvfb.
2024-09-30 23:33:49 +02:00
Yves-Marie Haussonne
2920b59e1b Remove debug info 2024-09-30 20:52:08 +02:00
Yves-Marie Haussonne
04dc86ceeb chore(ci): update OpenGL build step
Push images tagged with git SHA

- Added additional Docker image pushes for different tags derived from the Git SHA to sync with updated tagging conventions.
2024-09-30 20:08:57 +02:00
Yves-Marie Haussonne
ce7b1f2126 debug 2024-09-30 20:05:57 +02:00
Yves-Marie Haussonne
796aada661 chore(client): update Dockerfile and dependency versions
Update Dockerfile for client build process, including changes to base image and dependencies. Add support for OPENGL_BASE_IMAGE environment variable to facilitate easier image customization and maintenance.
2024-09-30 19:52:02 +02:00
Yves-Marie Haussonne
d0423c6c6b feat(client): update Minetest client Dockerfile
The commit updates the Minetest client Dockerfile by adjusting the COPY command indentation to correctly copy the minetest.conf file.  Update docker version to 27.
2024-09-30 19:29:41 +02:00
Yves-Marie Haussonne
9fb5b94eb0 chore(client): use single quotes for EOF marker
Updated the Dockerfile to use single quotes for the EOF marker in the minetest.conf file copy operation, ensuring consistent code styling and improved readability.
2024-09-30 19:06:48 +02:00
Yves-Marie Haussonne
89c6b4d62f chore(client): Update Dockerfile configuration
Refactor Dockerfile to remove redundant chown command and improve file copying efficiency. Ensure proper ownership of minetest configuration file.
2024-09-30 15:46:14 +02:00
Yves-Marie Haussonne
da790eec8e chore(ci): update docker build command in .gitlab-ci.yml
Adjusted the docker build command in the GitLab CI configuration file to use `docker buildx build` instead of `docker buildx` for building the OpenGL image.
2024-09-30 15:26:34 +02:00
Yves-Marie Haussonne
6179db0165 Add client dockerfile 2024-09-30 15:22:43 +02:00
Yves-Marie Haussonne
71e6f98c5d allow to start the build and relesase when starting a pipeline from the web 2024-09-30 13:16:12 +02:00
Yves-Marie Haussonne
5c32a398c5 start when it is manul 2024-09-30 13:08:49 +02:00
Yves-Marie Haussonne
3936076915 Rename to correct name 2024-09-30 12:59:09 +02:00
Yves-Marie Haussonne
858d58b21d move gitlab ci file to their right place. 2024-09-30 12:56:23 +02:00
Yves-Marie Haussonne
ff897425c5 add opengl image 2024-09-30 12:54:55 +02:00
Yves-Marie HAUSSONNE
0de9e699b6 Initial commit 2024-09-30 06:14:45 +00:00