From d4f33799b3ff60f2155d9d7833a9d8d7ae2b166f Mon Sep 17 00:00:00 2001
From: Jan David Mol <mol@astron.nl>
Date: Mon, 4 Oct 2021 07:49:22 +0200
Subject: [PATCH] L2SS-394: Remove need for LOFAR20_DIR from integration test.

---
 devices/integration_test/README.md |  3 +--
 devices/test/README.md             |  2 +-
 sbin/run_integration_test.sh       | 12 +++++++-----
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/devices/integration_test/README.md b/devices/integration_test/README.md
index a94aa174b..6609a2da6 100644
--- a/devices/integration_test/README.md
+++ b/devices/integration_test/README.md
@@ -16,8 +16,7 @@ are running and are in the required state.
 **Warning running these tests will make changes to your CDB database config!**
 
 ```shell
-source bootstrap/etc/lofar20rc.sh
-$LOFAR20_DIR/sbin/run_integration_test.sh
+sbin/run_integration_test.sh
 ```
 
 ## Limitations
diff --git a/devices/test/README.md b/devices/test/README.md
index 4007ef0a3..050b1de05 100644
--- a/devices/test/README.md
+++ b/devices/test/README.md
@@ -120,7 +120,7 @@ Docker container. A simple interactive Docker exec is enough to access them:
 
 ```sh
 docker exec -it device-sdp /bin/bash
-cd /opt/lofar2.0/tango/devices/
+cd /opt/lofar/tango/devices/
 tox
 ```
 
diff --git a/sbin/run_integration_test.sh b/sbin/run_integration_test.sh
index 684e7584e..3b7c09e51 100755
--- a/sbin/run_integration_test.sh
+++ b/sbin/run_integration_test.sh
@@ -1,9 +1,12 @@
 #!/bin/bash
 
-# Check if lofar20rc.sh is sourced and environment variables are set.
-if [ -z "$LOFAR20_DIR" ]; then
-  echo "\$LOFAR20_DIR is unset or blank, is lofar20rc.sh sourced correctly?"
-  exit 1
+if [ -z "$LOFA20_DIR"]; then
+    # We assume we aren't in the PATH, so we can derive our path.
+    # We need our parent directory.
+    LOFAR20_DIR_RELATIVE=`dirname "$0"`/..
+
+    # As an absolute path
+    LOFAR20_DIR=`readlink -f "${LOFAR20_DIR_RELATIVE}"`
 fi
 
 # Start and stop sequence
@@ -15,7 +18,6 @@ make start databaseds dsconfig jupyter elk
 sleep 15
 
 # Update the dsconfig
-cd "$TANGO_LOFAR_LOCAL_DIR" || exit 1
 sbin/update_ConfigDb.sh CDB/integration_ConfigDb.json
 
 cd "$LOFAR20_DIR/docker-compose" || exit 1
-- 
GitLab