From 26d932bc3b78b4f22ec78fd445bcc889a8b6c2ce Mon Sep 17 00:00:00 2001
From: Jan David Mol <mol@astron.nl>
Date: Tue, 24 Nov 2015 13:18:49 +0000
Subject: [PATCH] Task #8531: Added checks to t_getTreeGroup to see if system
 can run test. Removed mimetypes from t_getTreeGroup.{run,sh}.

---
 .gitattributes                   |  4 ++--
 SAS/OTDB/test/t_getTreeGroup.run | 10 ++++++++++
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/.gitattributes b/.gitattributes
index 30a9f9311c2..4ffff5aa740 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -4853,8 +4853,8 @@ SAS/OTDB/test/tBrokenHardware.cc -text
 SAS/OTDB/test/tMetadata.cc -text
 SAS/OTDB/test/tQueryPIC.cc -text
 SAS/OTDB/test/t_getTreeGroup.py -text
-SAS/OTDB/test/t_getTreeGroup.run -text svneol=unset#application/x-shellscript
-SAS/OTDB/test/t_getTreeGroup.sh -text svneol=unset#application/x-shellscript
+SAS/OTDB/test/t_getTreeGroup.run -text
+SAS/OTDB/test/t_getTreeGroup.sh -text
 SAS/OTDB/test/unittest_db.dump.gz -text svneol=unset#application/x-gzip
 SAS/OTDB_Services/CMakeLists.txt -text
 SAS/OTDB_Services/TreeService.py -text
diff --git a/SAS/OTDB/test/t_getTreeGroup.run b/SAS/OTDB/test/t_getTreeGroup.run
index 957d73c952a..7bb6837d697 100755
--- a/SAS/OTDB/test/t_getTreeGroup.run
+++ b/SAS/OTDB/test/t_getTreeGroup.run
@@ -2,6 +2,16 @@
 # constants
 DBHOST=sas099.control.lofar
 
+# This test requires Python 2.7+
+python -c 'import sys, os; sys.exit(1 - int(sys.version >= "2.7"))' || exit 3
+
+# This test requires access to DBHOST
+ping -w 1 -c 1 $DBHOST || exit 3
+
+# This test requires PostGres tooling
+which dropdb || exit 3
+which psql   || exit 3
+
 # Setup a clean database with predefined content
 dropdb -U postgres -h ${DBHOST} unittest_db
 gzip -dc $srcdir/unittest_db.dump.gz | psql -U postgres -h ${DBHOST} -f -
-- 
GitLab