summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAlex Solomes <alex.solomes@softwareag.com>2022-05-30 16:13:44 +0100
committerGitHub <noreply@github.com>2022-05-30 16:13:44 +0100
commit505b038e76e5ccf7da9c0323962f52ac734b76f8 (patch)
tree0ace9c70d552a902175d709decb6673d6622fd13 /tests
parente35df0d41d40f08cf23de01d3a1f3194c2e35616 (diff)
moved mqtt tests from Python to Rust #1011 (#1128)
Signed-off-by: initard <solo@softwareag.com> Co-authored-by: Lukasz Woznicki <lukasz.woznicki@softwareag.com> Co-authored-by: initard <solo@softwareag.com> Co-authored-by: Lukasz Woznicki <lukasz.woznicki@softwareag.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/PySys/local_mqtt/local_mqtt_pub_fail_noqos/pysystest.xml25
-rw-r--r--tests/PySys/local_mqtt/local_mqtt_pub_fail_noqos/run.py48
-rw-r--r--tests/PySys/local_mqtt/local_mqtt_pub_fail_qos0/pysystest.xml25
-rw-r--r--tests/PySys/local_mqtt/local_mqtt_pub_fail_qos0/run.py48
-rw-r--r--tests/PySys/local_mqtt/local_mqtt_pub_fail_qos1/pysystest.xml25
-rw-r--r--tests/PySys/local_mqtt/local_mqtt_pub_fail_qos1/run.py47
-rw-r--r--tests/PySys/local_mqtt/local_mqtt_pub_fail_qos2/pysystest.xml25
-rw-r--r--tests/PySys/local_mqtt/local_mqtt_pub_fail_qos2/run.py48
-rw-r--r--tests/PySys/local_mqtt/local_mqtt_pub_sub_with_sudo/pysystest.xml25
-rw-r--r--tests/PySys/local_mqtt/local_mqtt_pub_sub_with_sudo/run.py62
-rw-r--r--tests/PySys/local_mqtt/local_mqtt_sub_fail/pysystest.xml25
-rw-r--r--tests/PySys/local_mqtt/local_mqtt_sub_fail/run.py50
12 files changed, 0 insertions, 453 deletions
diff --git a/tests/PySys/local_mqtt/local_mqtt_pub_fail_noqos/pysystest.xml b/tests/PySys/local_mqtt/local_mqtt_pub_fail_noqos/pysystest.xml
deleted file mode 100644
index 16ffff7d..00000000
--- a/tests/PySys/local_mqtt/local_mqtt_pub_fail_noqos/pysystest.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<pysystest type="auto">
-
- <description>
- <title>Check error code when mosquitto is not running with no QoS set</title>
- <purpose><![CDATA[
-]]>
- </purpose>
- </description>
- <classification>
- <groups inherit="true">
- <group></group>
- </groups>
- <modes inherit="true">
- </modes>
- </classification>
- <data>
- <class name="PySysTest" module="run"/>
- </data>
- <traceability>
- <requirements>
- <requirement id=""/>
- </requirements>
- </traceability>
-</pysystest>
diff --git a/tests/PySys/local_mqtt/local_mqtt_pub_fail_noqos/run.py b/tests/PySys/local_mqtt/local_mqtt_pub_fail_noqos/run.py
deleted file mode 100644
index 5bd76d54..00000000
--- a/tests/PySys/local_mqtt/local_mqtt_pub_fail_noqos/run.py
+++ /dev/null
@@ -1,48 +0,0 @@
-from pysys.basetest import BaseTest
-import os
-
-"""
-Validate local publishing while no mosquitto is running
-
-Given a configured system
-When we stop mosquitto
-When we publish something without specifing qos level
-Then we expect an error code
-Then we restart mosquitto
-"""
-
-
-class PySysTest(BaseTest):
- def setup(self):
- self.tedge = "/usr/bin/tedge"
- self.sudo = "/usr/bin/sudo"
- self.systemctl = "/usr/bin/systemctl"
- self.environ = {"HOME": os.environ.get("HOME")}
-
- self.startProcess(
- command=self.sudo,
- arguments=[self.systemctl, "stop", "mosquitto"],
- stdouterr="stop",
- )
-
- self.addCleanupFunction(self.mycleanup)
-
- def execute(self):
-
- pub = self.startProcess(
- command=self.sudo,
- arguments=[self.tedge, "mqtt", "pub", "atopic", "amessage"],
- stdouterr="tedge_pub_fail",
- expectedExitStatus="==1",
- environs=self.environ,
- )
-
- # validate exit status with the expected status from calling startProcess
- self.assertThat("value" + pub.expectedExitStatus, value=pub.exitStatus)
-
- def mycleanup(self):
- self.startProcess(
- command=self.sudo,
- arguments=[self.systemctl, "start", "mosquitto"],
- stdouterr="start",
- )
diff --git a/tests/PySys/local_mqtt/local_mqtt_pub_fail_qos0/pysystest.xml b/tests/PySys/local_mqtt/local_mqtt_pub_fail_qos0/pysystest.xml
deleted file mode 100644
index 900deb47..00000000
--- a/tests/PySys/local_mqtt/local_mqtt_pub_fail_qos0/pysystest.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<pysystest type="auto">
-
- <description>
- <title>Check error code when mosquitto is not running with QoS set to 0</title>
- <purpose><![CDATA[
-]]>
- </purpose>
- </description>
- <classification>
- <groups inherit="true">
- <group></group>
- </groups>
- <modes inherit="true">
- </modes>
- </classification>
- <data>
- <class name="PySysTest" module="run"/>
- </data>
- <traceability>
- <requirements>
- <requirement id=""/>
- </requirements>
- </traceability>
-</pysystest>
diff --git a/tests/PySys/local_mqtt/local_mqtt_pub_fail_qos0/run.py b/tests/PySys/local_mqtt/local_mqtt_pub_fail_qos0/run.py
deleted file mode 100644
index 4af53c0a..00000000
--- a/tests/PySys/local_mqtt/local_mqtt_pub_fail_qos0/run.py
+++ /dev/null
@@ -1,48 +0,0 @@
-from pysys.basetest import BaseTest
-import os
-
-"""
-Validate local publishing while no mosquitto is running
-
-Given a configured system
-When we stop mosquitto
-When we publish something with qos 0
-Then we expect an error code
-Then we restart mosquitto
-"""
-
-
-class PySysTest(BaseTest):
- def setup(self):
- self.tedge = "/usr/bin/tedge"
- self.sudo = "/usr/bin/sudo"
- self.systemctl = "/usr/bin/systemctl"
- self.environ = {"HOME": os.environ.get("HOME")}
-
- self.startProcess(
- command=self.sudo,
- arguments=[self.systemctl, "stop", "mosquitto"],
- stdouterr="stop",
- )
-
- self.addCleanupFunction(self.mycleanup)
-
- def execute(self):
-
- pub = self.startProcess(
- command=self.tedge,
- arguments=["mqtt", "pub", "--qos", "0", "atopic", "amessage"],
- stdouterr="tedge_pub_fail",
- expectedExitStatus="==1",
- environs=self.environ,
- )
-
- # validate exit status with the expected status from calling startProcess
- self.assertThat("value" + pub.expectedExitStatus, value=pub.exitStatus)
-
- def mycleanup(self):
- self.startProcess(
- command=self.sudo,
- arguments=[self.systemctl, "start", "mosquitto"],
- stdouterr="start",
- )
diff --git a/tests/PySys/local_mqtt/local_mqtt_pub_fail_qos1/pysystest.xml b/tests/PySys/local_mqtt/local_mqtt_pub_fail_qos1/pysystest.xml
deleted file mode 100644
index 9a46a9c2..00000000
--- a/tests/PySys/local_mqtt/local_mqtt_pub_fail_qos1/pysystest.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<pysystest type="auto">
-
- <description>
- <title>Check error code when mosquitto is not running with QoS set to 1</title>
- <purpose><![CDATA[
-]]>
- </purpose>
- </description>
- <classification>
- <groups inherit="true">
- <group></group>
- </groups>
- <modes inherit="true">
- </modes>
- </classification>
- <data>
- <class name="PySysTest" module="run"/>
- </data>
- <traceability>
- <requirements>
- <requirement id=""/>
- </requirements>
- </traceability>
-</pysystest>
diff --git a/tests/PySys/local_mqtt/local_mqtt_pub_fail_qos1/run.py b/tests/PySys/local_mqtt/local_mqtt_pub_fail_qos1/run.py
deleted file mode 100644
index 48d095b4..00000000
--- a/tests/PySys/local_mqtt/local_mqtt_pub_fail_qos1/run.py
+++ /dev/null
@@ -1,47 +0,0 @@
-from pysys.basetest import BaseTest
-import os
-
-"""
-Validate local publishing while no mosquitto is running
-
-Given a configured system
-When we stop mosquitto
-When we publish something with qos 1
-Then we expect an error code
-Then we restart mosquitto
-"""
-
-
-class PySysTest(BaseTest):
- def setup(self):
- self.tedge = "/usr/bin/tedge"
- self.sudo = "/usr/bin/sudo"
- self.systemctl = "/usr/bin/systemctl"
- self.environ = {"HOME": os.environ.get("HOME")}
-
- self.startProcess(
- command=self.sudo,
- arguments=[self.systemctl, "stop", "mosquitto"],
- stdouterr="stop",
- )
-
- self.addCleanupFunction(self.mycleanup)
-
- def execute(self):
-
- pub = self.startProcess(
- command=self.tedge,
- arguments=["mqtt", "pub", "--qos", "1", "atopic", "amessage"],
- stdouterr="tedge_pub_fail",
- expectedExitStatus="==1",
- )
-
- # validate exit status with the expected status from calling startProcess
- self.assertThat("value" + pub.expectedExitStatus, value=pub.exitStatus)
-
- def mycleanup(self):
- self.startProcess(
- command=self.sudo,
- arguments=[self.systemctl, "start", "mosquitto"],
- stdouterr="start",
- )
diff --git a/tests/PySys/local_mqtt/local_mqtt_pub_fail_qos2/pysystest.xml b/tests/PySys/local_mqtt/local_mqtt_pub_fail_qos2/pysystest.xml
deleted file mode 100644
index a60a8ed4..00000000
--- a/tests/PySys/local_mqtt/local_mqtt_pub_fail_qos2/pysystest.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<pysystest type="auto">
-
- <description>
- <title>Check error code when mosquitto is not running with QoS set to 2</title>
- <purpose><![CDATA[
-]]>
- </purpose>
- </description>
- <classification>
- <groups inherit="true">
- <group></group>
- </groups>
- <modes inherit="true">
- </modes>
- </classification>
- <data>
- <class name="PySysTest" module="run"/>
- </data>
- <traceability>
- <requirements>
- <requirement id=""/>
- </requirements>
- </traceability>
-</pysystest>
diff --git a/tests/PySys/local_mqtt/local_mqtt_pub_fail_qos2/run.py b/tests/PySys/local_mqtt/local_mqtt_pub_fail_qos2/run.py
deleted file mode 100644
index b249eaaa..00000000
--- a/tests/PySys/local_mqtt/local_mqtt_pub_fail_qos2/run.py
+++ /dev/null
@@ -1,48 +0,0 @@
-from pysys.basetest import BaseTest
-import os
-
-"""
-Validate local publishing while no mosquitto is running
-
-Given a configured system
-When we stop mosquitto
-When we publish something with qos 2
-Then we expect an error code
-Then we restart mosquitto
-"""
-
-
-class PySysTest(BaseTest):
- def setup(self):
- self.tedge = "/usr/bin/tedge"
- self.sudo = "/usr/bin/sudo"
- self.systemctl = "/usr/bin/systemctl"
- self.environ = {"HOME": os.environ.get("HOME")}
-
- self.startProcess(
- command=self.sudo,
- arguments=[self.systemctl, "stop", "mosquitto"],
- stdouterr="stop",
- )
-
- self.addCleanupFunction(self.mycleanup)
-
- def execute(self):
-
- pub = self.startProcess(
- command=self.tedge,
- arguments=["mqtt", "pub", "--qos", "2", "atopic", "amessage"],
- stdouterr="tedge_pub_fail",
- expectedExitStatus="==1",
- environs=self.environ,
- )
-
- # validate exit status with the expected status from calling startProcess
- self.assertThat("value" + pub.expectedExitStatus, value=pub.exitStatus)
-
- def mycleanup(self):
- self.startProcess(
- command=self.sudo,
- arguments=[self.systemctl, "start", "mosquitto"],
- stdouterr="start",
- )
diff --git a/tests/PySys/local_mqtt/local_mqtt_pub_sub_with_sudo/pysystest.xml b/tests/PySys/local_mqtt/local_mqtt_pub_sub_with_sudo/pysystest.xml
deleted file mode 100644
index 045d3015..00000000
--- a/tests/PySys/local_mqtt/local_mqtt_pub_sub_with_sudo/pysystest.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<pysystest type="auto">
-
- <description>
- <title>Validate local publishing and subscribing</title>
- <purpose><![CDATA[
-]]>
- </purpose>
- </description>
- <classification>
- <groups inherit="true">
- <group></group>
- </groups>
- <modes inherit="true">
- </modes>
- </classification>
- <data>
- <class name="PySysTest" module="run"/>
- </data>
- <traceability>
- <requirements>
- <requirement id=""/>
- </requirements>
- </traceability>
-</pysystest>
diff --git a/tests/PySys/local_mqtt/local_mqtt_pub_sub_with_sudo/run.py b/tests/PySys/local_mqtt/local_mqtt_pub_sub_with_sudo/run.py
deleted file mode 100644
index c78e934e..00000000
--- a/tests/PySys/local_mqtt/local_mqtt_pub_sub_with_sudo/run.py
+++ /dev/null
@@ -1,62 +0,0 @@
-import pysys
-from pysys.basetest import BaseTest
-
-import time
-import os
-
-"""
-Validate local publishing and subscribing:
-
-Given a configured system
-When we start the bridge and the mapper
-When we start sudo tedge sub in the background
-When we start sudo tedge pub to publish a message
-When we start sudo tedge pub to publish another message
-Then we find the messages in the output of tedge sub
-"""
-
-
-class PySysTest(BaseTest):
- def execute(self):
- tedge = "/usr/bin/tedge"
- sudo = "/usr/bin/sudo"
-
- sub = self.startProcess(
- command=sudo,
- arguments=[tedge, "mqtt", "sub", "atopic"],
- stdouterr="tedge_sub",
- background=True,
- )
-
- # Wait for a small amount of time to give tedge sub time
- # to initialize. This is a heuristic measure.
- # Without an additional wait we observe failures in 1% of the test
- # runs.
- time.sleep(0.1)
-
- pub = self.startProcess(
- command=sudo,
- arguments=[tedge, "mqtt", "pub", "atopic", "amessage"],
- stdouterr="tedge_pub2",
- )
-
- pub = self.startProcess(
- command=sudo,
- arguments=[tedge, "mqtt", "pub", "atopic", "the message"],
- stdouterr="tedge_pub3",
- )
-
- # wait for a while before killing the subscribers
- time.sleep(1)
-
- # Kill the subscriber process explicitly with sudo as PySys does
- # not have the rights to do it
- kill = self.startProcess(
- command=sudo,
- arguments=["killall", "tedge"],
- stdouterr="kill_out",
- )
-
- def validate(self):
- self.assertGrep("tedge_sub.out", "amessage", contains=True)
- self.assertGrep("tedge_sub.out", "the message", contains=True)
diff --git a/tests/PySys/local_mqtt/local_mqtt_sub_fail/pysystest.xml b/tests/PySys/local_mqtt/local_mqtt_sub_fail/pysystest.xml
deleted file mode 100644
index a5a96522..00000000
--- a/tests/PySys/local_mqtt/local_mqtt_sub_fail/pysystest.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<pysystest type="auto">
-
- <description>
- <title>Validate local publishing when mosquitto is stopped</title>
- <purpose><![CDATA[
-]]>
- </purpose>
- </description>
- <classification>
- <groups inherit="true">
- <group></group>
- </groups>
- <modes inherit="true">
- </modes>
- </classification>
- <data>
- <class name="PySysTest" module="run"/>
- </data>
- <traceability>
- <requirements>
- <requirement id=""/>
- </requirements>
- </traceability>
-</pysystest>
diff --git a/tests/PySys/local_mqtt/local_mqtt_sub_fail/run.py b/tests/PySys/local_mqtt/local_mqtt_sub_fail/run.py
deleted file mode 100644
index 0dc74356..00000000
--- a/tests/PySys/local_mqtt/local_mqtt_sub_fail/run.py
+++ /dev/null
@@ -1,50 +0,0 @@
-from pysys.basetest import BaseTest
-
-import time
-import os
-
-"""
-Validate local subscribing while no mosquitto is running
-
-Given a configured system
-When we stop mosquitto
-When we subscribe to something
-Then we expect an error code
-Then we restart mosquitto
-"""
-
-
-class PySysTest(BaseTest):
- def setup(self):
- self.tedge = "/usr/bin/tedge"
- self.sudo = "/usr/bin/sudo"
- self.systemctl = "/usr/bin/systemctl"
- self.environ = {"HOME": os.environ.get("HOME")}
-
- self.startProcess(
- command=self.sudo,
- arguments=[self.systemctl, "stop", "mosquitto"],
- stdouterr="stop",
- )
-
- self.addCleanupFunction(self.mycleanup)
-
- def execute(self):
-
- pub = self.startProcess(
- command=self.tedge,
- arguments=["mqtt", "sub", "atopic"],
- stdouterr="tedge_sub_fail",
- expectedExitStatus="==1",
- environs=self.environ,
- )
-
- # validate exit status with the expected status from calling startProcess
- self.assertThat("value" + pub.expectedExitStatus, value=pub.exitStatus)
-
- def mycleanup(self):
- self.startProcess(
- command=self.sudo,
- arguments=[self.systemctl, "start", "mosquitto"],
- stdouterr="start",
- )