From 0acd34aad5e23895a5a2f246496d616f46ad63af Mon Sep 17 00:00:00 2001
From: Mawoka
Date: Mon, 8 Jul 2024 11:32:59 +0200
Subject: [PATCH] Cleanup of run_tests.sh script
---
.../src/lib/components/commandpalette.svelte | 1 -
run_tests.sh | 15 ++----
run_tests2.sh | 51 -------------------
temptest.sh | 12 -----
4 files changed, 5 insertions(+), 74 deletions(-)
delete mode 100755 run_tests2.sh
delete mode 100755 temptest.sh
diff --git a/frontend/src/lib/components/commandpalette.svelte b/frontend/src/lib/components/commandpalette.svelte
index e1ed2e3..c332ebc 100644
--- a/frontend/src/lib/components/commandpalette.svelte
+++ b/frontend/src/lib/components/commandpalette.svelte
@@ -247,7 +247,6 @@ This should be okay, right?
diff --git a/run_tests.sh b/run_tests.sh
index be9904b..d5c2ff0 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -9,18 +9,13 @@ run_tests() {
}
stop() {
- $CONTAINER_BIN container stop classquiz_db
- $CONTAINER_BIN container stop test_redis
- $CONTAINER_BIN container stop test_meili
+ $CONTAINER_BIN compose -f docker-compose.dev.yml down --volumes
}
init() {
mkdir /tmp/storage
- $CONTAINER_BIN run --rm -d -p 6379:6379 --name test_redis redis:alpine
- $CONTAINER_BIN run -it --rm -d -p 7700:7700 --name test_meili getmeili/meilisearch:v0.28.0
- $CONTAINER_BIN volume create classquiz_db_data
- $CONTAINER_BIN run --name classquiz_db -p 5432:5432 --rm -d -e POSTGRES_PASSWORD=mysecretpassword -v classquiz_db_data:/var/lib/postgresql/data -e POSTGRES_DB=classquiz postgres
- sleep 1
+ $CONTAINER_BIN compose -f docker-compose.dev.yml up -d
+ sleep 2
pipenv run alembic upgrade head
}
@@ -28,14 +23,14 @@ case $1 in
+) init ;;
-) stop ;;
a)
- $CONTAINER_BIN volume rm classquiz_db_data
+ $CONTAINER_BIN volume rm classquiz_db
init
run_tests
stop
;;
prepare)
stop
- $CONTAINER_BIN volume rm classquiz_db_data
+ $CONTAINER_BIN volume rm cclassquiz_db
init
;;
*)
diff --git a/run_tests2.sh b/run_tests2.sh
deleted file mode 100755
index cf3e9ca..0000000
--- a/run_tests2.sh
+++ /dev/null
@@ -1,51 +0,0 @@
-# SPDX-FileCopyrightText: 2023 Marlon W (Mawoka)
-#
-# SPDX-License-Identifier: MPL-2.0
-
-CONTAINER_BIN=podman
-
-run_tests() {
- pipenv run coverage run -m pytest -s -v --asyncio-mode=strict classquiz/tests
-}
-
-stop() {
- $CONTAINER_BIN container stop classquiz_db --time 2
- $CONTAINER_BIN container stop test_redis --time 2
- $CONTAINER_BIN container stop test_meili --time 2
- $CONTAINER_BIN rm classquiz_db --force
- $CONTAINER_BIN rm test_redis --force
- $CONTAINER_BIN rm test_meili --force
-}
-
-init() {
- if [ ! -d /tmp/storage ]; then
- mkdir /tmp/storage
- fi
-
- $CONTAINER_BIN run --rm -d -p 6379:6379 --name test_redis docker.io/redis:buster
- $CONTAINER_BIN run -it --rm -d -p 7700:7700 --name test_meili docker.io/getmeili/meilisearch:v0.28.0
- $CONTAINER_BIN volume create classquiz_db_data
- $CONTAINER_BIN run --name classquiz_db -p 5432:5432 --rm -d -e POSTGRES_PASSWORD=mysecretpassword -v classquiz_db_data:/var/lib/postgresql/data -e POSTGRES_DB=classquiz docker.io/postgres
- sleep 1
- pipenv run alembic upgrade head
-}
-
-case $1 in
-+) init ;;
--) stop ;;
-a)
- $CONTAINER_BIN volume rm classquiz_db_data
- init
- run_tests
- stop
- ;;
-prepare)
- stop
- $CONTAINER_BIN volume rm classquiz_db_data
- init
- ;;
-*)
- echo "Invalid option: -$OPTARG" >&2
- exit 1
- ;;
-esac
diff --git a/temptest.sh b/temptest.sh
deleted file mode 100755
index 2851276..0000000
--- a/temptest.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-# SPDX-FileCopyrightText: 2023 Marlon W (Mawoka)
-#
-# SPDX-License-Identifier: MPL-2.0
-
-if [ ! -d /tmp/storage ]; then
- echo "making storage"
- mkdir /tmp/storage
-else
- echo "storage already exists"
-
-# end of file
-fi