diff options
author | Lukasz Woznicki <lukasz.woznicki@softwareag.com> | 2022-02-09 12:59:13 +0000 |
---|---|---|
committer | Lukasz Woznicki <lukasz.woznicki@softwareag.com> | 2022-02-18 09:08:21 +0000 |
commit | b1907dc4780709bad572a7108314c563eb02b70a (patch) | |
tree | 3f6509c92eab17ade6ff1d824505699b98c4bd07 /tests | |
parent | 9d2122d8775509e14aa519436f86987502ffcd77 (diff) |
Remove sm mapper from config scripts and update docs to not mention it
anymore
Signed-off-by: Lukasz Woznicki <lukasz.woznicki@softwareag.com>
Diffstat (limited to 'tests')
4 files changed, 31 insertions, 24 deletions
diff --git a/tests/PySys/misc_features/custom_init_system/run.py b/tests/PySys/misc_features/custom_init_system/run.py index eb4e6dd8..4a2b6eba 100644 --- a/tests/PySys/misc_features/custom_init_system/run.py +++ b/tests/PySys/misc_features/custom_init_system/run.py @@ -1,6 +1,7 @@ -from pysys.basetest import BaseTest import os +from pysys.basetest import BaseTest + """ Validate tedge connect/disconnect use a given init system config @@ -64,7 +65,8 @@ class CustomInitSystem(BaseTest): self.assertGrep("tedge_connect.out", "Error", contains=False) self.assertGrep("tedge_disconnect.out", "Error", contains=False) self.assertGrep(self.dummy_init_output, "Error", contains=False) - self.assertGrep(self.dummy_init_output, "The system config file '/etc/tedge/system.toml' doesn't exist.", contains=False) + self.assertGrep(self.dummy_init_output, + "The system config file '/etc/tedge/system.toml' doesn't exist.", contains=False) expected_output = [ "is_available", @@ -74,13 +76,9 @@ class CustomInitSystem(BaseTest): "enable tedge-mapper-c8y", "restart tedge-agent", "enable tedge-agent", - "restart tedge-mapper-sm-c8y", - "enable tedge-mapper-sm-c8y", "is-active mosquitto", "stop tedge-mapper-c8y", "disable tedge-mapper-c8y", - "stop tedge-mapper-sm-c8y", - "disable tedge-mapper-sm-c8y", "stop tedge-agent", "disable tedge-agent", ] @@ -89,7 +87,6 @@ class CustomInitSystem(BaseTest): for word in expected_output: self.assertGrep(self.dummy_init_output, word, contains=True) - def custom_cleanup(self): # Remove system.toml from /etc/tedge, otherwise other tests will use the config. remove_system_config_file = self.startProcess( @@ -104,4 +101,3 @@ class CustomInitSystem(BaseTest): arguments=["rm", "-rf", self.tmp_dir], stdouterr="remove_dummy_init", ) - diff --git a/tests/PySys/software_management_end_to_end/sm_mapper_fail_and_reconnect/run.py b/tests/PySys/software_management_end_to_end/sm_mapper_fail_and_reconnect/run.py index 4960f0e1..09c9d0b3 100644 --- a/tests/PySys/software_management_end_to_end/sm_mapper_fail_and_reconnect/run.py +++ b/tests/PySys/software_management_end_to_end/sm_mapper_fail_and_reconnect/run.py @@ -1,6 +1,6 @@ +import subprocess import sys import time -import subprocess from pathlib import Path from environment_tedge import TedgeEnvironment @@ -23,13 +23,15 @@ Then validate subscriber output for `503,c8y_SoftwareUpdate` for final result of Then test has passed """ -class SmMapperC8yReceiveLastMessageOnRestart(TedgeEnvironment): + +class SmMapperC8yReceiveLastMessageOnRestart(BaseTest): systemctl = "/usr/bin/systemctl" tedge = "/usr/bin/tedge" sudo = "/usr/bin/sudo" apt = "/usr/bin/apt-get" mqtt_sub = "/usr/bin/mosquitto_sub" rm = "/usr/bin/rm" + def setup(self): self.addCleanupFunction(self.smcleanup) @@ -61,7 +63,7 @@ class SmMapperC8yReceiveLastMessageOnRestart(TedgeEnvironment): time.sleep(2) self.startProcess( command=self.sudo, - arguments=[self.systemctl, "stop", "tedge-mapper-sm-c8y.service"], + arguments=[self.systemctl, "stop", "tedge-mapper-c8y.service"], stdouterr="sm_mapper_stop", ) @@ -74,10 +76,10 @@ class SmMapperC8yReceiveLastMessageOnRestart(TedgeEnvironment): # check if the agent has completed the operation time.sleep(15) - + self.startProcess( command=self.sudo, - arguments=[self.systemctl, "restart", "tedge-mapper-sm-c8y.service"], + arguments=[self.systemctl, "restart", "tedge-mapper-c8y.service"], stdouterr="sm_mapper_restart", ) @@ -98,8 +100,12 @@ class SmMapperC8yReceiveLastMessageOnRestart(TedgeEnvironment): self.assertGrep("tedge_sub.out", "503,c8y_SoftwareUpdate", contains=True) def smcleanup(self): - self.log.info("Stop sm-mapper and agent") - self.tedge_disconnect_c8y() + self.log.info("Stop c8y-mapper and agent") + self.startProcess( + command=self.sudo, + arguments=[self.tedge, "disconnect", "c8y"], + stdouterr="connect_c8y", + ) def setup_mosquitto(self): self.startProcess( diff --git a/tests/PySys/tedge_connect/tedge_connect_test_sm_services/run.py b/tests/PySys/tedge_connect/tedge_connect_test_sm_services/run.py index c852a2e1..06bd4196 100644 --- a/tests/PySys/tedge_connect/tedge_connect_test_sm_services/run.py +++ b/tests/PySys/tedge_connect/tedge_connect_test_sm_services/run.py @@ -1,8 +1,9 @@ import sys -sys.path.append("environments") from environment_c8y import EnvironmentC8y +sys.path.append("environments") + """ Run connection test while being connected (positive case): @@ -26,14 +27,12 @@ class TedgeConnectTestSMServices(EnvironmentC8y): super().validate() self.log.info("Validate") - # Validate if the Software management services are getting started and - # enabled properly on "tedge connect c8y". - # Hint: EnvironmentTedge captures the log messages in tedge_connect.out + # Validate if the Software management services are getting started and enabled properly on "tedge disconnect c8y" + # EnvironmentC8y captures the log messages in tedge_connect.out self.assertGrep( "tedge_connect_c8y.out", "tedge-agent service successfully started and enabled!", contains=True ) self.assertGrep( - "tedge_connect_c8y.out", "tedge-mapper-sm-c8y service successfully started and enabled!", contains=True + "tedge_connect.out", "tedge-mapper-c8y service successfully started and enabled!", contains=True ) - diff --git a/tests/PySys/tedge_connect/tedge_disconnect_test_sm_services/run.py b/tests/PySys/tedge_connect/tedge_disconnect_test_sm_services/run.py index c93022b4..a374736f 100644 --- a/tests/PySys/tedge_connect/tedge_disconnect_test_sm_services/run.py +++ b/tests/PySys/tedge_connect/tedge_disconnect_test_sm_services/run.py @@ -1,8 +1,9 @@ import sys -sys.path.append("environments") from environment_c8y import EnvironmentC8y +sys.path.append("environments") + """ Run connection test while being connected : @@ -16,12 +17,17 @@ Then the test has passed """ + class TedgeDisConnectTestSMServices(EnvironmentC8y): # The base class rexecutes the `sudo tedge connect c8y` def validate(self): super().validate() - self.tedge_disconnect_c8y() + self.startProcess( + command=self.sudo, + arguments=[self.tedge, "disconnect", "c8y"], + stdouterr="tedge_disconnect_c8y", + ) # Validate if the Software management services are getting stopped and disabled properly on "tedge disconnect c8y" self.assertGrep( @@ -29,5 +35,5 @@ class TedgeDisConnectTestSMServices(EnvironmentC8y): ) self.assertGrep( - "tedge_disconnect_c8y.out", "tedge-mapper-sm-c8y service successfully stopped and disabled!", contains=True + "tedge_disconnect_c8y.out", "tedge-mapper-c8y service successfully stopped and disabled!", contains=True ) |