From 5642f139df4e1f760d010357678e062b38dc704b Mon Sep 17 00:00:00 2001 From: BuckarooBanzay Date: Tue, 2 Aug 2022 14:56:32 +0200 Subject: [PATCH] use `mtt` for integration tests --- .github/workflows/integration-test.yml | 15 ----- .github/workflows/test.yml | 17 ++++++ .luacheckrc | 2 +- README.md | 2 +- docker-compose.yml | 19 ++++++ init.lua | 4 ++ mod.conf | 4 +- mtt.lua | 10 ++++ test/Dockerfile | 10 ++++ test/auth.sqlite | Bin 24576 -> 0 bytes test/auth.txt | 4 -- test/integration-test.sh | 79 ------------------------- test/minetest.conf | 7 +-- test/start.sh | 10 ---- test/test_mod/init.lua | 7 --- test/test_mod/mod.conf | 2 - test/world.mt | 13 ++-- 17 files changed, 75 insertions(+), 130 deletions(-) delete mode 100644 .github/workflows/integration-test.yml create mode 100644 .github/workflows/test.yml create mode 100644 docker-compose.yml create mode 100644 mtt.lua create mode 100644 test/Dockerfile delete mode 100644 test/auth.sqlite delete mode 100644 test/auth.txt delete mode 100755 test/integration-test.sh delete mode 100755 test/start.sh delete mode 100644 test/test_mod/init.lua delete mode 100644 test/test_mod/mod.conf diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml deleted file mode 100644 index c9dd6f5..0000000 --- a/.github/workflows/integration-test.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: integration-test - -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-latest - timeout-minutes: 10 - - steps: - - uses: actions/checkout@master - - - name: integration-test - run: ./test/integration-test.sh diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..53f6399 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,17 @@ +name: test + +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-latest + timeout-minutes: 10 + strategy: + matrix: + ENGINE_VERSION: [5.3.0, 5.4.0, 5.5.0, latest] + + steps: + - uses: actions/checkout@v2 + - name: test + run: docker-compose up --exit-code-from sut diff --git a/.luacheckrc b/.luacheckrc index 71b6fae..9bd0493 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -18,5 +18,5 @@ read_globals = { "unified_inventory", "default", -- optional mods - "xban", "QoS" + "xban", "QoS", "mtt" } diff --git a/README.md b/README.md index f824c98..dce43c6 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Mail mod for Minetest (ingame mod) ====== -![](https://github.com/minetest-mail/mail_mod/workflows/integration-test/badge.svg) +![](https://github.com/minetest-mail/mail_mod/workflows/test/badge.svg) ![](https://github.com/minetest-mail/mail_mod/workflows/luacheck/badge.svg) diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..865f083 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,19 @@ +version: "3.6" + +services: + sut: + build: + context: ./test + args: + ENGINE_VERSION: ${ENGINE_VERSION:-5.5.0} + user: root + volumes: + - "./:/root/.minetest/worlds/world/worldmods/mail/" + - "world_data:/root/.minetest/worlds/world" + - "./test/world.mt:/root/.minetest/worlds/world/world.mt" + - "./test/minetest.conf:/minetest.conf" + ports: + - "30000:30000/udp" + +volumes: + world_data: {} \ No newline at end of file diff --git a/init.lua b/init.lua index 0f947ee..1b67e7e 100644 --- a/init.lua +++ b/init.lua @@ -64,3 +64,7 @@ end -- migrate storage mail.migrate() + +if minetest.get_modpath("mtt") then + dofile(MP .. "/mtt.lua") +end \ No newline at end of file diff --git a/mod.conf b/mod.conf index 7e9f894..e38d49b 100644 --- a/mod.conf +++ b/mod.conf @@ -1,3 +1,3 @@ name = mail -description = mail mod -optional_depends = unified_inventory,default,xban2,qos +description = ingame mail-system +optional_depends = unified_inventory,default,xban2,qos,mtt diff --git a/mtt.lua b/mtt.lua new file mode 100644 index 0000000..61c51da --- /dev/null +++ b/mtt.lua @@ -0,0 +1,10 @@ + +mtt.register("send mail", function(callback) + -- send a mail + mail.send("player1", "player2", "something", "blah") + + -- check the receivers inbox + local list2 = mail.getMessages("player2") + assert(list2 ~= nil and #list2 > 0) + callback() +end) \ No newline at end of file diff --git a/test/Dockerfile b/test/Dockerfile new file mode 100644 index 0000000..6324d80 --- /dev/null +++ b/test/Dockerfile @@ -0,0 +1,10 @@ +ARG ENGINE_VERSION=5.5.0 +FROM registry.gitlab.com/minetest/minetest/server:${ENGINE_VERSION} + +USER root +RUN apk add git &&\ + mkdir -p /root/.minetest/worlds/world/worldmods/ &&\ + git clone https://github.com/BuckarooBanzay/mtt /root/.minetest/worlds/world/worldmods/mtt + + +ENTRYPOINT minetestserver --config /minetest.conf \ No newline at end of file diff --git a/test/auth.sqlite b/test/auth.sqlite deleted file mode 100644 index e3f882920a157151ebc4af34d92adacfd6ff78b0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 24576 zcmeI(&x_mG9RP59Jeg#YOqAX1;6e!q=Fkit>fgU8g-Wt4|Bz%!mTYS-9@&y**^;cE zW6Onx9Vq=na@ccEdugGU-WIm!9(pM4p_lg3E_*3d_GV@`1A)EtkmW1;S$aSH-sj1N z_l)~IZ3G%RTX~iepvA=VL^7H91&SsTiO=G26o=d6Aig-fjl}2Vcdp-e`B~zp5AYM@ z>%@bTFA_)z`SRIcPri8e=6%H>9RxrC1V8`;KmY_l00ck)1VG^X2z)9YK1^pa$(wPY zOiV5GHE-;A#FWaGFG~?&V&gudWRB3T?9@Ns+?E)m=MR=l~Ol z7ACwZ7S1m?q0L}|jCM&GePyT@=v}#UqQ~|{0gGEeXUnmnqRpN_wkh_u>^UlsO;R9P zg6yM87|eGKoTEJ!ZICn>_l&^$1lAzWfBxVo&1aGc!&bG8@0#&?bsU#p?c?Kn9UtfK zB^+_7qaBL8H+fs#*W6IEr`o;f;X5YxGGEz>rCr1|&p-W9@?rY)GoJRU~H~* z!@irR^Pe0XrGIw%KC4}q#`)cAD!!i{?e3|QIHaEZGV$#7)BnaNI6wddKmY_l00ck) z1V8`;{yzdYuTw{f^slYMK=Xs*S^mssIggaxsUxj)*NS|N�sInIbC$5lsCxz8<@ z*&yp}M)q)hDQlU5f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