add integration test with sqlite db
This commit is contained in:
parent
6633dfacdb
commit
4d5537ba28
6
.github/workflows/docker.yml
vendored
6
.github/workflows/docker.yml
vendored
@ -8,9 +8,14 @@ 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:
|
||||
@ -19,4 +24,3 @@ jobs:
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
tag_names: true
|
||||
cache: 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
|
5
.gitignore
vendored
5
.gitignore
vendored
@ -1,9 +1,10 @@
|
||||
.releasetoken
|
||||
mapserver
|
||||
world.mt
|
||||
mapserver_mod
|
||||
./world.mt
|
||||
output
|
||||
test-output
|
||||
map.sqlite
|
||||
./map.sqlite
|
||||
mapserver.tiles
|
||||
mapserver.sqlite
|
||||
mapserver.sqlite-journal
|
||||
|
@ -13,8 +13,8 @@ RUN apk --no-cache add ca-certificates curl
|
||||
WORKDIR /app
|
||||
COPY --from=builder /server/output/mapserver-linux-x86_64 /bin/mapserver
|
||||
|
||||
HEALTHCHECK --interval=15s --timeout=3s \
|
||||
CMD curl -f http://localhost:8080/ || exit 1
|
||||
HEALTHCHECK --interval=5s --timeout=3s \
|
||||
CMD curl -f http://localhost:8080/api/config || exit 1
|
||||
|
||||
EXPOSE 8080
|
||||
CMD ["/bin/mapserver"]
|
||||
|
BIN
integration-test-world/map.sqlite
Normal file
BIN
integration-test-world/map.sqlite
Normal file
Binary file not shown.
5
integration-test-world/world.mt
Normal file
5
integration-test-world/world.mt
Normal file
@ -0,0 +1,5 @@
|
||||
gameid = minetest
|
||||
backend = sqlite3
|
||||
creative_mode = false
|
||||
enable_damage = false
|
||||
player_backend = files
|
21
integration-test.sh
Executable file
21
integration-test.sh
Executable file
@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
# build
|
||||
docker build . -t mapserver
|
||||
|
||||
docker run --name mapserver --rm \
|
||||
--network host \
|
||||
-v $(pwd)/integration-test-world:/app \
|
||||
mapserver &
|
||||
|
||||
function cleanup {
|
||||
# cleanup
|
||||
docker stop mapserver
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
bash -c 'while !</dev/tcp/localhost/8080; do sleep 1; done;'
|
||||
|
||||
curl http://127.0.0.1:8080/api/tile/0/0/0/0 > tile.png
|
||||
file tile.png | grep "PNG image data" || exit 1
|
@ -4,6 +4,7 @@ Minetest mapserver
|
||||
|
||||
![](https://github.com/minetest-mapserver/mapserver/workflows/jshint/badge.svg)
|
||||
![](https://github.com/minetest-mapserver/mapserver/workflows/go-test/badge.svg)
|
||||
![](https://github.com/minetest-mapserver/mapserver/workflows/integration-test/badge.svg)
|
||||
|
||||
![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/minetest-mapserver/mapserver)
|
||||
![GitHub repo size](https://img.shields.io/github/repo-size/minetest-mapserver/mapserver.svg)
|
||||
|
Loading…
Reference in New Issue
Block a user