build: output time spent on each setuponly test (#1569)

This commit is contained in:
Geoff Bourne
2022-06-18 09:56:53 -05:00
committed by GitHub
parent a18cf3348a
commit 30fa6d02c7
2 changed files with 32 additions and 3 deletions

View File

@@ -0,0 +1,19 @@
version: '3.8'
services:
mc:
image: itzg/minecraft-server
volumes:
- ./data:/data
- ./modpacks:/modpacks:ro
environment:
EULA: "true"
MEMORY: 2G
TYPE: FORGE
VERSION: 1.18.2
FORGEVERSION: 40.1.30
# Need to download Server-Files-0.4.13.zip and
# put it in modpacks directory next to this compose file
GENERIC_PACK: /modpacks/Server-Files-0.4.13.zip
ports:
- "25565:25565"

View File

@@ -15,6 +15,13 @@ $logs
"
}
delta() {
startTime=${1?}
endTime=$(date +%s)
echo "$(( endTime - startTime )) seconds"
}
# tests that only run the setup files for things like downloads and configuration.
setupOnlyMinecraftTest(){
folder=$1
@@ -32,19 +39,22 @@ setupOnlyMinecraftTest(){
fi
fi
start=$(date +%s)
if ! logs=$(docker-compose run mc 2>&1); then
outputContainerLog "$logs"
result=1
elif [ -f verify.sh ]; then
if ! docker run --rm --entrypoint bash -v "${PWD}/data":/data -v "${PWD}/verify.sh":/verify "${IMAGE_TO_TEST:-itzg/minecraft-server}" -e /verify; then
echo "Verify ${folder} FAILED"
endTime=$(date +%s)
echo "${folder} FAILED verify in $(delta start)"
outputContainerLog "$logs"
result=1
else
echo "Verify ${folder} PASS"
endTime=$(date +%s)
echo "${folder} PASSED verify in $(delta start)"
fi
else
echo "${folder} PASS"
echo "${folder} PASSED in $(delta start)"
fi
docker-compose down -v --remove-orphans > /dev/null