From e496f0ee14dbd4b14cb2a52e0d0a047baba4d38d Mon Sep 17 00:00:00 2001 From: Gligor Date: Wed, 3 Aug 2022 12:50:12 +0200 Subject: Transfered 2 Tests Signed-off-by: Gligor --- .gitignore | 9 ++ tests/RobotFramework/tedge/call_tedge.robot | 62 +++++++++ .../tedge/call_tedge_config_list.robot | 148 +++++++++++++++++++++ 3 files changed, 219 insertions(+) create mode 100644 tests/RobotFramework/tedge/call_tedge.robot create mode 100644 tests/RobotFramework/tedge/call_tedge_config_list.robot diff --git a/.gitignore b/.gitignore index a157d72c..4ad52107 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,15 @@ mapper/cumulocity/c8y_translator_lib/fuzz/Cargo.lock .venv/ .DS_Store +### robotframework ### +log.html +output.xml +report.html +selenium-screenshot-*.png +playwright-log.txt + +Results/ + # Log files generated by PySys tests/PySys/**/*.log tests/PySys/**/*.out diff --git a/tests/RobotFramework/tedge/call_tedge.robot b/tests/RobotFramework/tedge/call_tedge.robot new file mode 100644 index 00000000..425f49af --- /dev/null +++ b/tests/RobotFramework/tedge/call_tedge.robot @@ -0,0 +1,62 @@ +*** Settings *** +Documentation Purpose of this test is to verify that the proper version number +... will be shown by using the tedge -V command. +... By executing the tedge -h command that USAGE, OPTIONS and SUBCOMMANDS +... will be shown +... By executing the tedge -h -V command combination of both previous +... commands will be shown + +Library SSHLibrary +Library String + +Suite Setup Open Connection And Log In +Suite Teardown SSHLibrary.Close All Connections + +*** Variables *** +${HOST} 192.168.99.110 #Insert the IP address if the default should not be used +${USERNAME} pi #Insert the username if the default should not be used +${PASSWORD} thinedge #Insert the password if the default should not be used +${version} + +*** Tasks *** +Install thin-edge.io + ${output}= Execute Command curl -fsSL https://raw.githubusercontent.com/thin-edge/thin-edge.io/main/get-thin-edge_io.sh | sudo sh -s #running the script for installing latest version of tedge + ${line} Get Line ${output} 2 #getting the version which is installed out of the log + ${version} Fetch From Right ${line} : #Cutting log output in order only to keep version number + Set Suite Variable ${version} + Log ${version} #log of the output + Log ${output} #log of the output + +call tedge -V + ${output}= Execute Command tedge -V #execute command to check version + Should Contain ${output} ${version} #checking that the output of tedge -V returns the version which was installed + Log ${output} + +call tedge -h + ${output}= Execute Command tedge -h #execute command to call help + Should Contain ${output} USAGE: #checks if USAGE: exists + Should Contain ${output} OPTIONS: #checks if OPTIONS: exists + Should Contain ${output} SUBCOMMANDS: #checks if SUBCOMMANDS: exists + Log ${output} + +call tedge -h -V + ${output}= Execute Command tedge -h -V #execute command to call help and check the version at same time + Should Contain ${output} ${version} #checking that the output of tedge -V returns the version which was installed + Should Contain ${output} USAGE: #checks if USAGE: exists + Should Contain ${output} OPTIONS: #checks if OPTIONS: exists + Should Contain ${output} SUBCOMMANDS: #checks if SUBCOMMANDS: exists + Log ${output} + +call tedge help + ${output}= Execute Command tedge help #execute command to call help + Should Contain ${output} USAGE: #checks if USAGE: exists + Should Contain ${output} OPTIONS: #checks if OPTIONS: exists + Should Contain ${output} SUBCOMMANDS: #checks if SUBCOMMANDS: exists + Log ${output} + + + +*** Keywords *** +Open Connection And Log In + SSHLibrary.Open Connection ${HOST} + SSHLibrary.Login ${USERNAME} ${PASSWORD} \ No newline at end of file diff --git a/tests/RobotFramework/tedge/call_tedge_config_list.robot b/tests/RobotFramework/tedge/call_tedge_config_list.robot new file mode 100644 index 00000000..90a7dc96 --- /dev/null +++ b/tests/RobotFramework/tedge/call_tedge_config_list.robot @@ -0,0 +1,148 @@ +*** Settings *** +Documentation Purpose of this test is to verify that the tedge config list and tedge config list --all +... will result with Return Code 0 +... Set new device type and return to default value +... Set new kay path and return to default value +... Set new cert path and return to default value +... Set new c8y.root.cert.path and return to default value +... Set new c8y.smartrest.templates and return to default value +... Set new az.root.cert.path and return to default value +... Set new az.mapper.timestamp and return to default value +... Set new mqtt.bind_address and return to default value +... Set new mqtt.port and return to default value +... Set new tmp.path and return to default value +... Set new logs.path and return to default value +... Set new run.path and return to default value + +Library SSHLibrary + +Suite Setup Open Connection And Log In +Suite Teardown SSHLibrary.Close All Connections + +*** Variables *** +${HOST} 192.168.99.110 #Insert the IP address if the default should not be used +${USERNAME} pi #Insert the username if the default should not be used +${PASSWORD} thinedge #Insert the password if the default should not be used + +*** Tasks *** +tedge config list + ${rc} Execute Command tedge config list return_stdout=False return_rc=True #executing tedge config list and expect return code 0 + Should Be Equal As Integers ${rc} 0 + Log ${rc} +tedge config list --all + ${rc} Execute Command tedge config list --all return_stdout=False return_rc=True #executing tedge config list --all and expect return code 0 + Should Be Equal As Integers ${rc} 0 + Log ${rc} +set/unset device.type + Execute Command sudo tedge config set device.type changed-type #Changing device.type to "changed-type" + ${set} Execute Command tedge config list + Should Contain ${set} device.type=changed-type + Log ${set} + Execute Command sudo tedge config unset device.type #Undo the change by using the 'unset' command, value returns to default one + ${unset} Execute Command tedge config list + Should Contain ${unset} device.type=thin-edge.io + Log ${unset} +set/unset device.key.path + Execute Command sudo tedge config set device.key.path /etc/tedge/device-certs1/tedge-private-key.pem #Changing device.key.path + ${set} Execute Command tedge config list + Should Contain ${set} device.key.path=/etc/tedge/device-certs1/tedge-private-key.pem + Log ${set} + Execute Command sudo tedge config unset device.key.path #Undo the change by using the 'unset' command, value returns to default one + ${unset} Execute Command tedge config list + Should Contain ${unset} device.key.path=/etc/tedge/device-certs/tedge-private-key.pem + Log ${unset} +set/unset device.cert.path + Execute Command sudo tedge config set device.cert.path /etc/tedge/device-certs1/tedge-certificate.pem #Changing device.cert.path + ${set} Execute Command tedge config list + Should Contain ${set} device.cert.path=/etc/tedge/device-certs1/tedge-certificate.pem + Log ${set} + Execute Command sudo tedge config unset device.cert.path #Undo the change by using the 'unset' command, value returns to default one + ${unset} Execute Command tedge config list + Should Contain ${unset} device.cert.path=/etc/tedge/device-certs/tedge-certificate.pem + Log ${unset} +set/unset c8y.root.cert.path + Execute Command sudo tedge config set c8y.root.cert.path /etc/ssl/certs1 #Changing c8y.root.cert.path + ${set} Execute Command tedge config list + Should Contain ${set} c8y.root.cert.path=/etc/ssl/certs1 + Log ${set} + Execute Command sudo tedge config unset c8y.root.cert.path #Undo the change by using the 'unset' command, value returns to default one + ${unset} Execute Command tedge config list + Should Contain ${unset} c8y.root.cert.path=/etc/ssl/certs + Log ${unset} +set/unset c8y.smartrest.templates + Execute Command sudo tedge config set c8y.smartrest.templates 1 #Changing c8y.smartrest.templates + ${set} Execute Command tedge config list + Should Contain ${set} c8y.smartrest.templates=["1"] + Log ${set} + Execute Command sudo tedge config unset c8y.smartrest.templates #Undo the change by using the 'unset' command, value returns to default one + ${unset} Execute Command tedge config list + Should Contain ${unset} c8y.smartrest.templates=[] + Log ${unset} +set/unset az.root.cert.path + Execute Command sudo tedge config set az.root.cert.path /etc/ssl/certs1 #Changing az.root.cert.path + ${set} Execute Command tedge config list + Should Contain ${set} az.root.cert.path=/etc/ssl/certs1 + Log ${set} + Execute Command sudo tedge config unset az.root.cert.path #Undo the change by using the 'unset' command, value returns to default one + ${unset} Execute Command tedge config list + Should Contain ${unset} az.root.cert.path=/etc/ssl/certs + Log ${unset} +set/unset az.mapper.timestamp + Execute Command sudo tedge config set az.mapper.timestamp false #Changing az.mapper.timestamp + ${set} Execute Command tedge config list + Should Contain ${set} az.mapper.timestamp=false + Log ${set} + Execute Command sudo tedge config unset az.mapper.timestamp #Undo the change by using the 'unset' command, value returns to default one + ${unset} Execute Command tedge config list + Should Contain ${unset} az.mapper.timestamp=true + Log ${unset} +set/unset mqtt.bind_address + Execute Command sudo tedge config set mqtt.bind_address 127.1.1.1 #Changing mqtt.bind_address + ${set} Execute Command tedge config list + Should Contain ${set} mqtt.bind_address=127.1.1.1 + Log ${set} + Execute Command sudo tedge config unset mqtt.bind_address #Undo the change by using the 'unset' command, value returns to default one + ${unset} Execute Command tedge config list + Should Contain ${unset} mqtt.bind_address=127.0.0.1 + Log ${unset} +set/unset mqtt.port + Execute Command sudo tedge config set mqtt.port 8888 #Changing mqtt.port + ${set} Execute Command tedge config list + Should Contain ${set} mqtt.port=8888 + Log ${set} + Execute Command sudo tedge config unset mqtt.port #Undo the change by using the 'unset' command, value returns to default one + ${unset} Execute Command tedge config list + Should Contain ${unset} mqtt.port=1883 + Log ${unset} +set/unset tmp.path + Execute Command sudo tedge config set tmp.path /tmp1 #Changing tmp.path + ${set} Execute Command tedge config list + Should Contain ${set} tmp.path=/tmp1 + Log ${set} + Execute Command sudo tedge config unset tmp.path #Undo the change by using the 'unset' command, value returns to default one + ${unset} Execute Command tedge config list + Should Contain ${unset} tmp.path=/tmp + Log ${unset} +set/unset logs.path + Execute Command sudo tedge config set logs.path /var/log1 #Changing logs.path + ${set} Execute Command tedge config list + Should Contain ${set} logs.path=/var/log1 + Log ${set} + Execute Command sudo tedge config unset logs.path #Undo the change by using the 'unset' command, value returns to default one + ${unset} Execute Command tedge config list + Should Contain ${unset} logs.path=/var/log + Log ${unset} +set/unset run.path + Execute Command sudo tedge config set run.path /run1 #Changing run.path + ${set} Execute Command tedge config list + Should Contain ${set} run.path=/run1 + Log ${set} + Execute Command sudo tedge config unset run.path #Undo the change by using the 'unset' command, value returns to default one + ${unset} Execute Command tedge config list + Should Contain ${unset} run.path=/run + Log ${unset} + +*** Keywords *** +Open Connection And Log In + SSHLibrary.Open Connection ${HOST} + SSHLibrary.Login ${USERNAME} ${PASSWORD} \ No newline at end of file -- cgit v1.2.3 From 384629784e18c8c4c0545fed490b97d2f36999d2 Mon Sep 17 00:00:00 2001 From: Gligor Date: Thu, 4 Aug 2022 08:25:27 +0200 Subject: Added tedge_connect tests Signed-off-by: Gligor --- .../tedge_connect/tedge_connect_test.robot | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 tests/RobotFramework/tedge_connect/tedge_connect_test.robot diff --git a/tests/RobotFramework/tedge_connect/tedge_connect_test.robot b/tests/RobotFramework/tedge_connect/tedge_connect_test.robot new file mode 100644 index 00000000..9f16452e --- /dev/null +++ b/tests/RobotFramework/tedge_connect/tedge_connect_test.robot @@ -0,0 +1,49 @@ +*** Settings *** +Documentation Run connection test while being connected and check the positive response in stdout +... disconnect the device from cloud and check the negative message in stderr +... Run sudo tedge connect c8y and check + +Library SSHLibrary +Library CryptoLibrary variable_decryption=True +Library Dialogs + +Suite Setup Open Connection And Log In +Suite Teardown SSHLibrary.Close All Connections + + +*** Variables *** +${HOST} 192.168.99.110 #Insert the IP address if the default should not be used +${USERNAME} pi #Insert the username if the default should not be used +${PASSWORD} thinedge #Insert the password if the default should not be used + +*** Tasks *** +tedge_connect_test_positive + Execute Command sudo tedge connect c8y #Connecting to Cumulocity IoT + ${stdout}= Execute Command sudo tedge connect c8y --test #Testing the status of the connection + Should Contain ${stdout} Connection check to c8y cloud is successful. #Expected message + Log ${stdout} + +tedge_connect_test_negative + Execute Command sudo tedge disconnect c8y #Disonnecting from Cumulocity IoT + ${stdout} ${stderr}= Execute Command sudo tedge connect c8y --test return_stderr=True #Testing the status of the connection + Should Contain ${stderr} Error: failed to test connection to Cumulocity cloud. #Expected message + Log ${stderr} + +tedge_connect_test_sm_services + ${stdout} Execute Command sudo tedge connect c8y #Connecting to Cumulocity IoT + Should Contain ${stdout} Successfully created bridge connection! #Expected message + Should Contain ${stdout} tedge-agent service successfully started and enabled! #Expected message + Should Contain ${stdout} tedge-mapper-c8y service successfully started and enabled! #Expected message + Log ${stdout} +tedge_disconnect_test_sm_services + ${stdout} Execute Command sudo tedge disconnect c8y #Disonnecting from Cumulocity IoT + Should Contain ${stdout} Cumulocity Bridge successfully disconnected! #Expected message + Should Contain ${stdout} tedge-agent service successfully stopped and disabled! #Expected message + Should Contain ${stdout} tedge-mapper-c8y service successfully stopped and disabled! #Expected message + Log ${stdout} + +*** Keywords *** +Open Connection And Log In + + SSHLibrary.Open Connection ${HOST} + SSHLibrary.Login ${USERNAME} ${PASSWORD} \ No newline at end of file -- cgit v1.2.3 From fb1e555ecbf004e8a84ccac5767c3c71da05bf4e Mon Sep 17 00:00:00 2001 From: Gligor Date: Fri, 5 Aug 2022 11:14:46 +0200 Subject: Add empty line on end of Testrun Signed-off-by: Gligor --- tests/RobotFramework/tedge/call_tedge.robot | 3 ++- tests/RobotFramework/tedge/call_tedge_config_list.robot | 3 ++- tests/RobotFramework/tedge_connect/tedge_connect_test.robot | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/RobotFramework/tedge/call_tedge.robot b/tests/RobotFramework/tedge/call_tedge.robot index 425f49af..34228a70 100644 --- a/tests/RobotFramework/tedge/call_tedge.robot +++ b/tests/RobotFramework/tedge/call_tedge.robot @@ -59,4 +59,5 @@ call tedge help *** Keywords *** Open Connection And Log In SSHLibrary.Open Connection ${HOST} - SSHLibrary.Login ${USERNAME} ${PASSWORD} \ No newline at end of file + SSHLibrary.Login ${USERNAME} ${PASSWORD} + \ No newline at end of file diff --git a/tests/RobotFramework/tedge/call_tedge_config_list.robot b/tests/RobotFramework/tedge/call_tedge_config_list.robot index 90a7dc96..5e5b3c08 100644 --- a/tests/RobotFramework/tedge/call_tedge_config_list.robot +++ b/tests/RobotFramework/tedge/call_tedge_config_list.robot @@ -145,4 +145,5 @@ set/unset run.path *** Keywords *** Open Connection And Log In SSHLibrary.Open Connection ${HOST} - SSHLibrary.Login ${USERNAME} ${PASSWORD} \ No newline at end of file + SSHLibrary.Login ${USERNAME} ${PASSWORD} + \ No newline at end of file diff --git a/tests/RobotFramework/tedge_connect/tedge_connect_test.robot b/tests/RobotFramework/tedge_connect/tedge_connect_test.robot index 9f16452e..2a7b2d8f 100644 --- a/tests/RobotFramework/tedge_connect/tedge_connect_test.robot +++ b/tests/RobotFramework/tedge_connect/tedge_connect_test.robot @@ -46,4 +46,4 @@ tedge_disconnect_test_sm_services Open Connection And Log In SSHLibrary.Open Connection ${HOST} - SSHLibrary.Login ${USERNAME} ${PASSWORD} \ No newline at end of file + SSHLibrary.Login ${USERNAME} ${PASSWORD} -- cgit v1.2.3