From c1663b6a005c2986b407b57b61f4b97c2e8d7c9a Mon Sep 17 00:00:00 2001
From: Lubomir Bucek <lubomir.bucek@eox.at>
Date: Fri, 23 Oct 2020 11:29:31 +0200
Subject: [PATCH] cleanup, should still fail

---
 .gitlab-ci.yml            |  2 +-
 testing/gitlab_test.sh    | 10 ++--------
 testing/registrar_test.sh | 10 +---------
 3 files changed, 4 insertions(+), 18 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e1ef5eb2..6f9eddf1 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -38,7 +38,7 @@ build-master:
     - docker pull "$IMAGE_6":latest || true
     - docker build --cache-from "$IMAGE_6":latest -t "$IMAGE_6":latest -t "$IMAGE_6":$VERSION_6 ingestor/
     - cd ./testing && ./gitlab_test.sh
-    - if [ $? -ne 0 ]; then echo "fail" && exit 1; fi
+    - if [ $? -ne 0 ]; then exit 1; fi  # actually fail build
     - docker push "$IMAGE_1":$VERSION_1
     - docker push "$IMAGE_1":latest
     - docker push "$IMAGE_2":$VERSION_2
diff --git a/testing/gitlab_test.sh b/testing/gitlab_test.sh
index ad7ecafb..33ffa61e 100755
--- a/testing/gitlab_test.sh
+++ b/testing/gitlab_test.sh
@@ -46,14 +46,8 @@ docker service ls
 
 bash ./registrar_test.sh product_list.csv
 
-if [ $? -eq 0 ]
-then
-  echo "Script success"
-  exit 0
-else
-  echo "Script fail"
-  exit 1
-fi
+if [ $? -ne 0 ]; then exit 1; fi
+
 # docker exec -i $(docker ps -qf "name=emg-pvs_registrar") python3 /var/www/pvs/dev/pvs_instance/manage.py storage create pvs_testing pvs_testing --type swift --storage-auth auth-cloud-ovh
 # docker exec -i $(docker ps -qf "name=emg-pvs_registrar") python3 /core/registrar.py --objects-prefix "OA/PH1B/0.1/b9/urn:eop:PHR:MULTISPECTRAL_0.5m:DS_PHR1B_201608070959189_FR1_PX_E012N32_0719_00974_4148/0000/PH1B_PHR_FUS_1A_20160807T095918_20160807T095920_TOU_1234_4148.DIMA.tar"
 # pytest -s registrar_test.py --name OA/PH1B/0.1/b9/urn:eop:PHR:MULTISPECTRAL_0.5m:DS_PHR1B_201608070959189_FR1_PX_E012N32_0719_00974_4148/0000/PH1B_PHR_FUS_1A_20160807T095918_20160807T095920_TOU_1234_4148.DIMA.tar
diff --git a/testing/registrar_test.sh b/testing/registrar_test.sh
index f993e801..70e750cf 100755
--- a/testing/registrar_test.sh
+++ b/testing/registrar_test.sh
@@ -14,12 +14,4 @@ while read product; do
 done < "$product_list_file"
 
 pytest
-
-if [ $? -eq 0 ]
-then
-  echo "Pytest success"
-  exit 0
-else
-  echo "Pytest fail" >&2
-  exit 1
-fi
\ No newline at end of file
+if [ $? -ne 0 ]; then echo "Pytest fail" >&2 && exit 1; fi
\ No newline at end of file
-- 
GitLab