aboutsummaryrefslogtreecommitdiffstats
path: root/robot
diff options
context:
space:
mode:
authorbiswajit.deswali <Biswajit.Deswali@amdocs.com>2021-12-30 19:45:05 +0530
committerBiswajit Deswali <biswajit.deswali@amdocs.com>2022-01-05 08:16:33 +0000
commit8e49e424f6863a93516d1d68011fd7f7e925c7c8 (patch)
tree19798507dc1fbe4da7cc3668216de10edad725aa /robot
parentbae8d839893d1ce5c1e9dfa670fbe536520093a0 (diff)
[SO] MariaDB Galera connectivity with SO Issue-ID:SO-3829
Issue-ID: SO-3829 Change-Id: I53423414ef71a69ac88c89fe2259f7cb8365770a Signed-off-by: biswajit.deswali <Biswajit.Deswali@amdocs.com>
Diffstat (limited to 'robot')
-rw-r--r--robot/resources/mariadb_galera_interface.robot48
-rw-r--r--robot/testsuites/health-check.robot9
2 files changed, 57 insertions, 0 deletions
diff --git a/robot/resources/mariadb_galera_interface.robot b/robot/resources/mariadb_galera_interface.robot
new file mode 100644
index 00000000..9dd6f4af
--- /dev/null
+++ b/robot/resources/mariadb_galera_interface.robot
@@ -0,0 +1,48 @@
+*** Settings ***
+Documentation The main interface for interacting with Mariadb Galera. It contains the keywords which will login to the Mariadb Galera pod and validates SO databases connectivity.
+
+Library Collections
+Library OperatingSystem
+Library String
+
+*** Variables ***
+&{MARIADB_GALERA_CREDENTIALS} user=root password=secretpassword
+@{MARIADB_GALERA_SO_DATABASES} catalogdb requestdb camundabpmn
+@{CONNECTION_ERROR_MESSAGE} Can't connect No such file or directory command terminated
+${POD_LOGGED_IN_MESSAGE} logged into Mariadb Galera pod
+${MYSQL_STATUS_MESSAGE} Current database:
+
+
+*** Keywords ***
+Fetch Namespace
+ [Documentation] This keyword is responsible for fetching and returning the value of namespace from the provided Global IP Address variable.
+ [Arguments] ${GLOBAL_INJECTED_SO_BPMN_IP_ADDR}
+ ${namespace}= Evaluate "${GLOBAL_INJECTED_SO_BPMN_IP_ADDR}".split(".")[-1]
+ [Return] ${namespace}
+
+Check for Mariadb Galera Pod Connection
+ [Documentation] This keyword is responsible for logging into the Mariadb Galera pod and check if we can login to the Mariadb Galera pod. To verify we print a string and match the output whether the same string was returned or not.
+ [Arguments] ${message}=${POD_LOGGED_IN_MESSAGE}
+ ${namespace}= Fetch Namespace ${GLOBAL_INJECTED_SO_BPMN_IP_ADDR}
+ # Extracting the mariadb galera pod and storing it into a variable
+ ${mariadb_pod}= Run kubectl -n ${namespace} get po -o name | grep -w 'mariadb-galera-[0-9]'
+ ${pod_connectivity_command}= Catenate kubectl -n ${namespace} exec ${mariadb_pod} -- sh -c "echo ${message}"
+ ${pod_connectivity_output}= Run ${pod_connectivity_command}
+ # The output should contain the exact same message which we are printing by logging into the Mariadb Galera pod
+ Should Contain ${pod_connectivity_output} ${message} ignore_case=True
+
+Check for SO Databases Connection
+ [Documentation] This keyword is responsible for logging into the Mariadb Galera pod and check if we can login to the SO MySQL Databases.
+ ${namespace}= Fetch Namespace ${GLOBAL_INJECTED_SO_BPMN_IP_ADDR}
+ # Extracting the mariadb galera pod and storing it into a variable
+ ${mariadb_pod}= Run kubectl -n ${namespace} get po -o name | grep -w 'mariadb-galera-[0-9]'
+ # Looping through all 3 mariadb galera databases (catalogdb, requestdb and camundabpmn) to validate SO connectivity
+ FOR ${index} IN RANGE 3
+ ${mysql_connectivity_command}= Catenate kubectl -n ${namespace} exec ${mariadb_pod} -- sh
+ ... -c "mysql -u ${MARIADB_GALERA_CREDENTIALS}[user] -p${MARIADB_GALERA_CREDENTIALS}[password] ${MARIADB_GALERA_SO_DATABASES}[${index}]
+ ... -e 'status'"
+ ${mysql_connectivity_output}= Run ${mysql_connectivity_command}
+ # The output should contain the message that is having SO databases name.
+ Should Contain ${mysql_connectivity_output} ${MYSQL_STATUS_MESSAGE} ${MARIADB_GALERA_SO_DATABASES}[${index}] ignore_case=True
+ Should Not Contain Any ${CONNECTION_ERROR_MESSAGE} ${mysql_connectivity_output} ignore_case=True
+ END
diff --git a/robot/testsuites/health-check.robot b/robot/testsuites/health-check.robot
index 3025a903..6ebf5bd8 100644
--- a/robot/testsuites/health-check.robot
+++ b/robot/testsuites/health-check.robot
@@ -28,6 +28,7 @@ Resource ../resources/pomba_interface.robot
Resource ../resources/holmes_interface.robot
Resource ../resources/cds_interface.robot
Resource ../resources/dcae_ms_interface.robot
+Resource ../resources/mariadb_galera_interface.robot
Suite Teardown Close All Browsers
@@ -340,3 +341,11 @@ Enhanced CDS Health Check
Run CDS Publish CBA Health Check
Run CDS Process CBA Health Check
Run CDS Delete CBA Health Check
+
+Mariadb Galera Pod Connectivity Test
+ [Tags] core health-mariadb-galera
+ Check for Mariadb Galera Pod Connection
+
+Mariadb Galera SO Connectivity Test
+ [Tags] core health-mariadb-galera
+ Check for SO Databases Connection