From 0a8645a03b7228b796ef819752c4ceebc059da60 Mon Sep 17 00:00:00 2001
From: lukken <lukken@astron.nl>
Date: Wed, 21 Jul 2021 11:51:42 +0000
Subject: [PATCH] L2SS-240: Test to get state from DeviceProxy

---
 devices/integration_test/README.md      | 18 +++++++++++++++++-
 devices/integration_test/test_device.py |  4 +++-
 devices/tox.ini                         |  1 +
 docker-compose/integration-test.yml     |  1 -
 4 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/devices/integration_test/README.md b/devices/integration_test/README.md
index e6bb82149..9bf4efee9 100644
--- a/devices/integration_test/README.md
+++ b/devices/integration_test/README.md
@@ -1,3 +1,19 @@
 # Integration tests
 
-**Warning running these tests will make changes to your local system**
\ No newline at end of file
+**Warning running these tests will make changes to your local system**
+
+## Approach
+
+A special docker container is build to perform the integration tests. This
+container will be build by the makefiles but should only be started by the
+dedicated integration test script. This script will ensure that other containers
+are running and are in the required state.
+
+* Launch pypcc-sim and sdptr-sim simulators.
+* Reconfigure dsconfig to use these simulators.
+* Create and start the integration-test container.
+
+## Limitations
+
+Our makefile will always launch the new container upon creation, resulting in
+the integration tests actually being run twice.
\ No newline at end of file
diff --git a/devices/integration_test/test_device.py b/devices/integration_test/test_device.py
index 9d5fe51d1..036280823 100644
--- a/devices/integration_test/test_device.py
+++ b/devices/integration_test/test_device.py
@@ -19,4 +19,6 @@ class TestDevice(base.IntegrationTestCase):
 
 
     def test_device(self):
-        d = DeviceProxy("LTS/SDP/1")
\ No newline at end of file
+        d = DeviceProxy("LTS/SDP/1")
+
+        self.assertEqual("ON", d.state())
diff --git a/devices/tox.ini b/devices/tox.ini
index 6d9305632..94d33c3e3 100644
--- a/devices/tox.ini
+++ b/devices/tox.ini
@@ -19,6 +19,7 @@ commands = stestr run {posargs}
 
 [testenv:integration]
 ; Warning running integration tests will make changes to your docker system!
+; These tests should only be run by the integration-test docker container.
 passenv = TANGO_HOST
 setenv = TESTS_DIR=./integration_test
 commands =
diff --git a/docker-compose/integration-test.yml b/docker-compose/integration-test.yml
index b79f70500..e6a0e5493 100644
--- a/docker-compose/integration-test.yml
+++ b/docker-compose/integration-test.yml
@@ -27,4 +27,3 @@ services:
       - --strict
       - --
       - tox -e integration
-    restart: on-failure
-- 
GitLab