aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2019-06-20 16:25:28 -0700
committerGravatar MarkKoz <[email protected]>2019-06-22 13:36:38 -0700
commitc1a6440899ced2f3f787352cd1d3ea1f49e520ee (patch)
treea753feeeb0f28765576584465de2b80c2b3cd008 /scripts
parentUse dev.sh script for running tests and coverage (diff)
Fix ownership of coverage file
When coverage runs in a container, it is ran under root so the resulting coverage file is owned by root. chown is used to change ownership to be the same as the folder it is in.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/dev.sh11
1 files changed, 10 insertions, 1 deletions
diff --git a/scripts/dev.sh b/scripts/dev.sh
index 490021f..6ebae71 100755
--- a/scripts/dev.sh
+++ b/scripts/dev.sh
@@ -31,7 +31,7 @@ fi
docker run \
-it \
- --rm \
+ --name snekbox_test \
--privileged \
--network host \
-h pdsnk-dev \
@@ -43,3 +43,12 @@ docker run \
--entrypoint /bin/ash \
pythondiscord/snekbox-venv:dev \
"$@"
+
+# Fix ownership of coverage file
+docker start snekbox_test >/dev/null
+docker exec \
+ -it \
+ snekbox_test \
+ /bin/ash \
+ -c 'chown "$(stat -c "%u:%g" "/snekbox-local")" /snekbox-local/.coverage'
+docker rm -f snekbox_test >/dev/null