From eb188ebba194a9a3939b2699e4659c8fc08656ec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20tom=20W=C3=B6rden?= <h.tomwoerden@indiscale.com>
Date: Wed, 4 Aug 2021 08:15:37 +0000
Subject: [PATCH] MAINT: add safety check for integration tests

The integration tests delete all data in a CaosDB server. This is now displayed again in a question before starting the tests.
---
 .docker/Dockerfile       |  2 +-
 integrationtests/test.sh | 14 ++++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/.docker/Dockerfile b/.docker/Dockerfile
index 4ad0d623..43e5eff1 100644
--- a/.docker/Dockerfile
+++ b/.docker/Dockerfile
@@ -31,4 +31,4 @@ RUN rm -r /git/.git \
     && mv /git/.docker/pycaosdb.ini /git/integrationtests
 RUN cd /git && pip3 install .[h5-crawler]
 WORKDIR /git/integrationtests
-CMD /wait-for-it.sh caosdb-server:10443 -t 500 -- ./test.sh
+CMD /wait-for-it.sh caosdb-server:10443 -t 500 -- ./test.sh --force
diff --git a/integrationtests/test.sh b/integrationtests/test.sh
index 80a2afe3..5efd5495 100755
--- a/integrationtests/test.sh
+++ b/integrationtests/test.sh
@@ -1,4 +1,18 @@
 #!/bin/bash
+if [ "$1" != "--force" ]
+then
+    echo "Warning: For these tests, the whole database will be deleted. Do you want to proceed? (yes/Exit)"
+    read safety
+    if [ -z $safety ]
+    then
+        echo "Exiting..."
+        exit 0
+    elif [ $safety != "yes" ]
+    then
+        echo "Exiting..."
+        exit 0
+    fi
+fi
 OUT=/tmp/crawler.output
 ls 
 cat pycaosdb.ini
-- 
GitLab