summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgligorisaev <34868628+gligorisaev@users.noreply.github.com>2022-08-10 11:31:36 +0200
committerGitHub <noreply@github.com>2022-08-10 11:31:36 +0200
commit8a89c5c9229dd5a0b7b37f5154e8da025a8be1ad (patch)
tree6ed79fbb583ffaefb2e99a9fa89a00119fc968a5
parent098cd1bc0b8a5fb46d114733c5f5c632fc25587e (diff)
parent4907b14d6a43546837babe7c6d9a05423b7346bb (diff)
Merge pull request #1327 from gligorisaev/improvement/1172/add-test-for-MQTT-health-check
Add RF test case for MQTT health check c8y
-rw-r--r--tests/RobotFramework/MQTT_health_check/MQTT_health_endpoints.robot53
1 files changed, 53 insertions, 0 deletions
diff --git a/tests/RobotFramework/MQTT_health_check/MQTT_health_endpoints.robot b/tests/RobotFramework/MQTT_health_check/MQTT_health_endpoints.robot
new file mode 100644
index 00000000..e719b507
--- /dev/null
+++ b/tests/RobotFramework/MQTT_health_check/MQTT_health_endpoints.robot
@@ -0,0 +1,53 @@
+*** Settings ***
+Library SSHLibrary
+Suite Setup Open Connection And Log In
+Suite Teardown SSHLibrary.Close All Connections
+
+*** Variables ***
+${HOST} 192.168.100.110
+${USERNAME} pi
+${PASSWORD} thinedge
+${pid}
+*** Tasks ***
+
+Connect to Cumulocity
+ ${rc}= Execute Command sudo tedge connect c8y
+ Log ${rc}=
+
+Start c8y-log-plugin
+ ${rc}= Execute Command sudo systemctl start c8y-log-plugin.service return_stdout=False return_rc=True
+ Should Be Equal As Integers ${rc} 0
+
+Note the PID Number
+ ${pid} Execute Command pgrep c8y_log_plugin
+ Set Suite Variable ${pid}
+
+Start MQTT Subscriber c8y-log-plugin & send empty message
+
+ Write sudo tedge mqtt sub 'tedge/health/c8y-log-plugin' &
+ Write sudo tedge mqtt pub 'tedge/health-check/c8y-log-plugin' ''
+ ${output}= Read delay=1s
+ Should Contain ${output} "pid":${pid}
+ Should Contain ${output} "status":"up"
+
+Start c8y-configuration-plugin
+ ${rc}= Execute Command sudo systemctl start c8y-configuration-plugin.service return_stdout=False return_rc=True
+ Should Be Equal As Integers ${rc} 0
+
+Note the PID Number
+ ${pid} Execute Command pgrep c8y_configurati
+ Set Suite Variable ${pid}
+
+Start MQTT Subscriber health-check & send empty message
+
+ Write sudo tedge mqtt sub 'tedge/health/c8y-configuration-plugin' &
+ Write sudo tedge mqtt pub 'tedge/health-check/c8y-configuration-plugin' ''
+ ${output}= Read delay=1s
+ Should Contain ${output} "pid":${pid}
+ Should Contain ${output} "status":"up"
+
+*** Keywords ***
+Open Connection And Log In
+ SSHLibrary.Open Connection ${HOST}
+ SSHLibrary.Login ${USERNAME} ${PASSWORD}
+ \ No newline at end of file