diff --git a/gorgone/tests/robot/config/engine.yaml b/gorgone/tests/robot/config/engine.yaml index e0c1c5caeb..976357dd79 100644 --- a/gorgone/tests/robot/config/engine.yaml +++ b/gorgone/tests/robot/config/engine.yaml @@ -3,4 +3,4 @@ gorgone: - name: engine package: "gorgone::modules::centreon::engine::hooks" enable: true - command_file: "/var/lib/centreon-engine/rw/centengine_poller.cmd" \ No newline at end of file + command_file: "/var/lib/centreon-engine/rw/centengine_poller.cmd" diff --git a/gorgone/tests/robot/tests/centreon/legacycmd.robot b/gorgone/tests/robot/tests/centreon/legacycmd.robot index 8879b07020..560116ca51 100644 --- a/gorgone/tests/robot/tests/centreon/legacycmd.robot +++ b/gorgone/tests/robot/tests/centreon/legacycmd.robot @@ -11,7 +11,7 @@ Legacycmd with ${communication_mode} communication [Teardown] Legacycmd Teardown comm=${tmp} @{central_config} Create List ${ROOT_CONFIG}legacycmd.yaml ${ROOT_CONFIG}engine.yaml ${ROOT_CONFIG}actions.yaml - @{poller_config} Create List ${ROOT_CONFIG}actions.yaml + @{poller_config} Create List ${ROOT_CONFIG}actions.yaml ${ROOT_CONFIG}engine.yaml Setup Two Gorgone Instances ... central_config=${central_config} ... communication_mode=${communication_mode} @@ -20,7 +20,7 @@ Legacycmd with ${communication_mode} communication ... poller_config=${poller_config} Force Check Execution On Poller comm=${communication_mode} - + Push Engine And vmware Configuration comm=${communication_mode} Examples: communication_mode -- ... push_zmq ... pullwss @@ -34,8 +34,42 @@ Legacycmd Teardown Stop Gorgone And Remove Gorgone Config @{process_list} sql_file=${ROOT_CONFIG}db_delete_poller.sql Terminate Process pipeWatcher_${comm} Run rm -rf /var/cache/centreon/config + Run rm -rf /etc/centreon/centreon_vmware.json +Push Engine And vmware Configuration + [Arguments] ${comm}= ${poller_id}=2 + Copy File ${CURDIR}${/}legacycmd${/}centreon_vmware.json /var/cache/centreon/config/vmware/${poller_id}/ + Copy File ${CURDIR}${/}legacycmd${/}broker.cfg /var/cache/centreon/config/broker/${poller_id}/ + Copy File ${CURDIR}${/}legacycmd${/}engine-hosts.cfg /var/cache/centreon/config/engine/${poller_id}/ + # we change all the configuration files to be sure it was copied in this run and not a rest of another test. + Run sed -i -e 's/@COMMUNICATION_MODE@/${comm}/g' /var/cache/centreon/config/vmware/${poller_id}/centreon_vmware.json + Run sed -i -e 's/@COMMUNICATION_MODE@/${comm}/g' /var/cache/centreon/config/broker/${poller_id}/broker.cfg + Run sed -i -e 's/@COMMUNICATION_MODE@/${comm}/g' /var/cache/centreon/config/engine/${poller_id}/engine.cfg + # gorgone central should get these files, and send it to poller in /etc/centreon/, /etc/centreon-broker/, /etc/centreon-engine/ + ${log_query} Create List /var/cache/centreon/config/vmware/2/centreon_vmware.json + # SENDCFGFILE say to gorgone to push conf to poller for a poller id. + Run echo SENDCFGFILE:${poller_id} > /var/lib/centreon/centcore/random.cmd + ${log_status} Ctn Find In Log With Timeout log=/var/log/centreon-gorgone/${comm}_gorgone_central/gorgoned.log content=${log_query} regex=0 timeout=20 + Should Be True ${log_status} Didn't found the logs : ${log_status} + Log To Console File should be set in /etc/centreon/ now + + ${res}= Run cat /etc/centreon/centreon_vmware.json + Should Be Equal As Strings ${res} {"communication mode": "${comm}"} data in /etc/centreon/centreon_vmware.json is not correct. + # check the user/group and permission are right. as gorgone run as root in the tests and as centreon-gorgone in prod, this might be different from real life. + ${vmware_stat}= Run stat -c "%a %U %G" /etc/centreon/centreon_vmware.json + Should Be Equal As Strings ${vmware_stat} 664 centreon-gorgone centreon + # check engine conf file + ${res}= Run cat /etc/centreon-engine/engine-hosts.cfg + Should Be Equal As Strings ${res} Engine conf, communicationmode:${comm} data in /etc/centreon-engine/engine-hosts.cfg is not correct. + ${vmware_stat}= Run stat -c "%a %U %G" /etc/centreon-engine/engine-hosts.cfg + Should Be Equal As Strings ${vmware_stat} 664 centreon-engine centreon + #check Broker conf file + ${res}= Run cat /etc/centreon-broker/broker.cfg + Should Be Equal As Strings ${res} Broker conf, communication mode:${comm} data in /etc/centreon-broker/broker.cfg is not correct. + ${vmware_stat}= Run stat -c "%a %U %G" /etc/centreon-broker/broker.cfg + Should Be Equal As Strings ${vmware_stat} 664 centreon-broker centreon + Force Check Execution On Poller [Arguments] ${comm}= diff --git a/gorgone/tests/robot/tests/centreon/legacycmd/broker.cfg b/gorgone/tests/robot/tests/centreon/legacycmd/broker.cfg new file mode 100644 index 0000000000..a41ba7e735 --- /dev/null +++ b/gorgone/tests/robot/tests/centreon/legacycmd/broker.cfg @@ -0,0 +1 @@ +Broker conf, communication mode:@COMMUNICATION_MODE@ \ No newline at end of file diff --git a/gorgone/tests/robot/tests/centreon/legacycmd/centreon_vmware.json b/gorgone/tests/robot/tests/centreon/legacycmd/centreon_vmware.json index bb1c0030f1..e7e01006b6 100644 --- a/gorgone/tests/robot/tests/centreon/legacycmd/centreon_vmware.json +++ b/gorgone/tests/robot/tests/centreon/legacycmd/centreon_vmware.json @@ -1,3 +1 @@ -{ - "test": "tuutu" -} \ No newline at end of file +{"communication mode": "@COMMUNICATION_MODE@"} \ No newline at end of file diff --git a/gorgone/tests/robot/tests/centreon/legacycmd/engine-hosts.cfg b/gorgone/tests/robot/tests/centreon/legacycmd/engine-hosts.cfg new file mode 100644 index 0000000000..a1ce282d8c --- /dev/null +++ b/gorgone/tests/robot/tests/centreon/legacycmd/engine-hosts.cfg @@ -0,0 +1 @@ +Engine conf, communicationmode:@COMMUNICATION_MODE@ \ No newline at end of file