diff mbox series

[4/6] support/testing/tests/package/test_mender.py: Add a systemd test

Message ID 20241014102123.3727883-5-adam.duskett@amarulasolutions.com
State New
Headers show
Series mender cleanup and intermittent update | expand

Commit Message

Adam Duskett Oct. 14, 2024, 10:21 a.m. UTC
- Move the check for /var/run/mender.pid to before self.run_mender_test()
    for the two tests using sysvinit.

  - Instead of checking for /var/run/mender.pid during the systemd test,
    check to ensure "systemctl is-active mender-client" returns "active"

Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com>
---
 support/testing/tests/package/test_mender.py | 21 ++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/support/testing/tests/package/test_mender.py b/support/testing/tests/package/test_mender.py
index 0938cb77e1..7f606eb729 100644
--- a/support/testing/tests/package/test_mender.py
+++ b/support/testing/tests/package/test_mender.py
@@ -20,8 +20,6 @@  class TestMenderInfra(infra.basetest.BRTest):
         self.emulator.login()
 
     def run_mender_test(self):
-        # Check if the Daemon is running
-        self.assertRunOk("ls /var/run/mender.pid")
         self.assertRunOk("ps aux | egrep [m]ender")
 
         # Check if a simple Mender command is correctly executed
@@ -35,6 +33,9 @@  class TestMenderInfra(infra.basetest.BRTest):
 class TestMenderRW(TestMenderInfra):
     def test_run(self):
         TestMenderInfra.base_test_run(self)
+
+        # Check if the Daemon is running
+        self.assertRunOk("ls /var/run/mender.pid")
         self.run_mender_test()
 
 
@@ -47,4 +48,20 @@  class TestMenderRO(TestMenderInfra):
 
     def test_run(self):
         TestMenderInfra.base_test_run(self)
+
+        # Check if the Daemon is running
+        self.assertRunOk("ls /var/run/mender.pid")
+        self.run_mender_test()
+
+class TestMenderSystemd(TestMenderInfra):
+    config = \
+        """
+        {}
+        BR2_INIT_SYSTEMD=y
+        """.format(TestMenderInfra.config)
+
+    def test_run(self):
+        TestMenderInfra.base_test_run(self)
+        output, _ = self.emulator.run("systemctl is-active mender-client")
+        self.assertEqual(output[0], "active")
         self.run_mender_test()