Skip to content

Commit

Permalink
ci(Gorgone): add legacycmd test to push engine and vmware configuration
Browse files Browse the repository at this point in the history
Refs:MON-144643
  • Loading branch information
Evan-Adam committed Sep 23, 2024
1 parent 4787680 commit e4b6e55
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 6 deletions.
2 changes: 1 addition & 1 deletion gorgone/tests/robot/config/engine.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
command_file: "/var/lib/centreon-engine/rw/centengine_poller.cmd"
38 changes: 36 additions & 2 deletions gorgone/tests/robot/tests/centreon/legacycmd.robot
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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
Expand All @@ -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}=

Expand Down
1 change: 1 addition & 0 deletions gorgone/tests/robot/tests/centreon/legacycmd/broker.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Broker conf, communication mode:@COMMUNICATION_MODE@
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
{
"test": "tuutu"
}
{"communication mode": "@COMMUNICATION_MODE@"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Engine conf, communicationmode:@COMMUNICATION_MODE@

0 comments on commit e4b6e55

Please sign in to comment.