add dummy integration test
This commit is contained in:
parent
00aa1d606a
commit
1c5213ac89
@ -1 +1,3 @@
|
||||
node_modules
|
||||
test_mod
|
||||
mail_mod
|
||||
|
7
.github/workflows/docker.yml
vendored
7
.github/workflows/docker.yml
vendored
@ -8,13 +8,18 @@ on:
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
|
||||
- name: integration-test
|
||||
run: ./integration-test.sh
|
||||
|
||||
- name: docker publish
|
||||
uses: elgohr/Publish-Docker-Github-Action@master
|
||||
with:
|
||||
name: minetestmail/mail
|
||||
name: blockexchange/blockexchange
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
tag_names: true
|
||||
|
15
.github/workflows/integration-test.yml
vendored
Normal file
15
.github/workflows/integration-test.yml
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
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: ./integration-test.sh
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
||||
node_modules
|
||||
mail_mod
|
||||
|
46
integration-test.sh
Executable file
46
integration-test.sh
Executable file
@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
|
||||
# build
|
||||
docker build . -t mail
|
||||
|
||||
docker run --name mail --rm \
|
||||
-e WEBMAILKEY=myserverkey \
|
||||
-e WEBMAIL_DEBUG=true \
|
||||
--network host \
|
||||
mail &
|
||||
|
||||
function cleanup {
|
||||
# cleanup
|
||||
docker stop mail
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
bash -c 'while !</dev/tcp/localhost/8080; do sleep 1; done;'
|
||||
|
||||
git clone https://github.com/minetest-mail/mail_mod.git
|
||||
|
||||
CFG=/tmp/minetest.conf
|
||||
MTDIR=/tmp/mt
|
||||
WORLDDIR=${MTDIR}/worlds/world
|
||||
|
||||
cat <<EOF > ${CFG}
|
||||
secure.http_mods = mail
|
||||
webmail.url = 127.0.0.1:8080
|
||||
webmail.key = myserverkey
|
||||
EOF
|
||||
|
||||
mkdir -p ${WORLDDIR}
|
||||
chmod 777 ${MTDIR} -R
|
||||
docker run --rm -i \
|
||||
-v ${CFG}:/etc/minetest/minetest.conf:ro \
|
||||
-v ${MTDIR}:/var/lib/minetest/.minetest \
|
||||
-v $(pwd)/mail_mod:/var/lib/minetest/.minetest/worlds/world/worldmods/mail \
|
||||
-v $(pwd)/test_mod:/var/lib/minetest/.minetest/worlds/world/worldmods/mail_test \
|
||||
--network host \
|
||||
registry.gitlab.com/minetest/minetest/server:5.2.0
|
||||
|
||||
test -f ${WORLDDIR}/integration_test.json && exit 0 || exit 1
|
||||
|
||||
|
||||
echo "Test complete!"
|
17
test_mod/init.lua
Normal file
17
test_mod/init.lua
Normal file
@ -0,0 +1,17 @@
|
||||
|
||||
minetest.log("warning", "[TEST] integration-test enabled!")
|
||||
|
||||
minetest.register_on_mods_loaded(function()
|
||||
minetest.log("warning", "[TEST] starting tests")
|
||||
minetest.after(0, function()
|
||||
minetest.log("warning", "[TEST] integration tests done!")
|
||||
minetest.request_shutdown("success")
|
||||
|
||||
local data = minetest.write_json({ success = true }, true);
|
||||
local file = io.open(minetest.get_worldpath().."/integration_test.json", "w" );
|
||||
if file then
|
||||
file:write(data)
|
||||
file:close()
|
||||
end
|
||||
end)
|
||||
end)
|
2
test_mod/mod.conf
Normal file
2
test_mod/mod.conf
Normal file
@ -0,0 +1,2 @@
|
||||
name = mail_test
|
||||
depends = mail
|
Loading…
x
Reference in New Issue
Block a user