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.
This commit is contained in:
parent
0a2e282dae
commit
18fdb914a5
@ -29,7 +29,7 @@ test_harness:
|
|||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- echo "Starting tests"
|
- echo "Starting tests"
|
||||||
- .util/run_tests.sh -i $CLIENT_CONTAINER_GITSHA_IMAGE -d docker -D
|
- .util/run_tests.sh -i $CLIENT_CONTAINER_GITSHA_IMAGE --docker -D
|
||||||
|
|
||||||
build_opengl:
|
build_opengl:
|
||||||
stage: build
|
stage: build
|
||||||
|
@ -7,6 +7,6 @@
|
|||||||
"strip":1
|
"strip":1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"minetest-add-conf": "",
|
"minetest_add_conf": "",
|
||||||
"client_nb": 1
|
"client_nb": 1
|
||||||
}
|
}
|
||||||
|
20
README.md
20
README.md
@ -22,24 +22,32 @@ This mod's goal is to provide a test framework for implementing tests for minete
|
|||||||
|
|
||||||
1. Declare `test_harness` as an optional dependencies for your mod
|
1. Declare `test_harness` as an optional dependencies for your mod
|
||||||
2. copy the `.util` folder in your project
|
2. copy the `.util` folder in your project
|
||||||
3. copy the `.util/.mod_env.tmpl` to `.mod_env` at the root of your folder.
|
3. copy the `.util/.mod_env.json.tmpl` to `.mod_env.json` at the root of your folder.
|
||||||
4. adapt its content. Do not remove the test_harness dependency definition.
|
4. adapt its content. Do not remove the test_harness dependency definition.
|
||||||
5. if necessary, customize the `.util/Dockerfile` to adapt the `/etc/minetest/minetest.conf.base` file to list the mods you want to test (`test_harness_mods`), and to adjust the server configuration to your project test settings.
|
5. The list of mods to test can be set in the `additional_mods` key. This list will be added to `current_mod`, if you add some mods, the list must start with a comma.
|
||||||
6. In your source files (in the `init.lua` for example) add the following lines (or equivalent)
|
6. customize the minetest server configuration by adding configuration values in the `minetest_add_conf` value. This must be a single string, with line returns if necessary.
|
||||||
|
7. if necessary, customize the `.util/Dockerfile` if the previous means are not sufficients.
|
||||||
|
8. In your source files (in the `init.lua` for example) add the following lines (or equivalent)
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
if minetest.settings:get_bool("test_harness_run_tests", false) then
|
if minetest.settings:get_bool("test_harness_run_tests", false) then
|
||||||
dofile(minetest.get_modpath("my_mod").. "/test/init.lua")
|
dofile(minetest.get_modpath("my_mod").. "/test/init.lua")
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
7. In your test file(s), get an instance of the method allowing the registration of your tests:
|
|
||||||
|
9. In your test file(s), get an instance of the method allowing the registration of your tests:
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
local register_test = test_harness.get_test_registrator("my_mod", my_mod.version_string)
|
local register_test = test_harness.get_test_registrator("my_mod", my_mod.version_string)
|
||||||
```
|
```
|
||||||
8. Register the test by calling `register_test`
|
|
||||||
9. Run the test by lauching the `run_tests.sh` script. For example with Podman
|
10. Register the test by calling `register_test`
|
||||||
|
11. Run the test by lauching the `run_tests.sh` script. For example with Podman
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ .util/run_tests.sh --podman -c 1
|
$ .util/run_tests.sh --podman -c 1
|
||||||
```
|
```
|
||||||
|
|
||||||
See the available options with `.util/run_tests.sh --help`
|
See the available options with `.util/run_tests.sh --help`
|
||||||
|
|
||||||
## Sources
|
## Sources
|
||||||
|
Loading…
x
Reference in New Issue
Block a user