Skip to content

Commit

Permalink
fix(gorgone-tests): fix tests
Browse files Browse the repository at this point in the history
MON-48766
  • Loading branch information
Evan-Adam committed Jul 9, 2024
1 parent cc2a1b0 commit 7c317c6
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/docker/Dockerfile.gorgone-testing-alma8
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM almalinux:8

RUN bash -e <<EOF

dnf install -y dnf-plugins-core zstd curl mariadb iproute
dnf install -y dnf-plugins-core zstd curl mariadb iproute procps
dnf install -y https://rpms.remirepo.net/enterprise/remi-release-8.rpm
dnf config-manager --set-enabled 'powertools'
dnf -y config-manager --add-repo https://packages.centreon.com/rpm-standard/23.10/el8/centreon-23.10.repo
Expand Down
2 changes: 1 addition & 1 deletion .github/docker/Dockerfile.gorgone-testing-bullseye
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ENV LANG en_US.utf8
RUN bash -e <<EOF
apt-get update
# Install Robotframework
apt-get install -y python3 python3-dev python3-pip ca-certificates apt-transport-https software-properties-common wget gnupg2
apt-get install -y python3 python3-dev python3-pip ca-certificates apt-transport-https software-properties-common wget gnupg2 procps
pip3 install robotframework robotframework-examples robotframework-databaselibrary pymysql robotframework-requests robotframework-jsonlibrary

echo "deb https://packages.centreon.com/apt-standard-23.10-stable/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/centreon.list
Expand Down
4 changes: 2 additions & 2 deletions gorgone/tests/robot/resources/resources.resource
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ Setup Two Gorgone Instances
# gorgone can generate it's own key, but as we need the thumbprint in the configuration we need to generate them before launching gorgone.
# this script only create key if the files don't exists, and silently finish if the files already exists.
IF '${communication_mode}' == 'push_zmq'
Setup Gorgone Config ${push_central_config} ${gorgone_core_config} gorgone_name=${central_name} sql_file=${ROOT_CONFIG}push_db_1_poller.sql
Setup Gorgone Config ${push_central_config} ${gorgone_core_config} gorgone_name=${central_name} sql_file=${ROOT_CONFIG}db_add_1_poller.sql
Setup Gorgone Config ${push_poller_config} gorgone_name=${poller_name}

Start Gorgone debug ${central_name}
Expand All @@ -127,7 +127,7 @@ Setup Two Gorgone Instances
Check Poller Is Connected port=5556 expected_nb=2
Check Poller Communicate 2
ELSE IF '${communication_mode}' == 'pullwss'
Setup Gorgone Config ${pullwss_central_config} ${ROOT_CONFIG}pullwss_node_register_one_node.yaml ${gorgone_core_config} gorgone_name=${central_name} sql_file=${ROOT_CONFIG}push_db_1_poller.sql
Setup Gorgone Config ${pullwss_central_config} ${ROOT_CONFIG}pullwss_node_register_one_node.yaml ${gorgone_core_config} gorgone_name=${central_name} sql_file=${ROOT_CONFIG}db_add_1_poller.sql
Setup Gorgone Config ${gorgone_core_config} ${pullwss_poller_config} gorgone_name=${poller_name}

Start Gorgone debug ${central_name}
Expand Down
2 changes: 1 addition & 1 deletion gorgone/tests/robot/tests/core/pullwss.robot
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Test Timeout 220s

*** Test Cases ***
check one poller can connect to a central gorgone
[Teardown] Stop Gorgone And Remove Gorgone Config @{process_list} #sql_file=${ROOT_CONFIG}push_db_1_poller_delete.sql
[Teardown] Stop Gorgone And Remove Gorgone Config @{process_list} sql_file=${ROOT_CONFIG}db_delete_poller.sql

Log To Console \nStarting the gorgone setup
Setup Two Gorgone Instances communication_mode=pullwss central_name=pullwss_gorgone_central poller_name=pullwss_gorgone_poller_2
Expand Down
2 changes: 1 addition & 1 deletion gorgone/tests/robot/tests/core/push.robot
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Test Timeout 220s

*** Test Cases ***
connect 1 poller to a central
[Teardown] Stop Gorgone And Remove Gorgone Config @{process_list} sql_file=${ROOT_CONFIG}push_db_1_poller_delete.sql
[Teardown] Stop Gorgone And Remove Gorgone Config @{process_list} sql_file=${ROOT_CONFIG}db_delete_poller.sql

Log To Console \nStarting the gorgone setup
Setup Two Gorgone Instances communication_mode=push_zmq central_name=push_zmq_gorgone_central poller_name=push_zmq_gorgone_poller_2
Expand Down
38 changes: 32 additions & 6 deletions gorgone/tests/robot/tests/long_tests/fd-leak.robot
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ Test Timeout 1200s
*** Test Cases ***
check gorgone proxy do not leak file descriptor
[Tags] long_tests
[Teardown] Stop Gorgone And Remove Gorgone Config push_gorgone_central sql_file=${ROOT_CONFIG}db_delete_poller.sql
[Teardown] Stop Gorgone And Remove Gorgone Config push_gorgone_central_no_poller sql_file=${ROOT_CONFIG}db_delete_poller.sql

Log To Console \nStarting the gorgone setup
@{central_push_config}= Create List ${push_central_config} ${gorgone_core_config}

Setup Gorgone Config @{central_push_config} gorgone_name=push_gorgone_central sql_file=${ROOT_CONFIG}db_add_1_poller.sql

Start Gorgone debug push_gorgone_central
Setup Gorgone Config @{central_push_config} gorgone_name=push_gorgone_central_no_poller sql_file=${ROOT_CONFIG}db_add_1_poller.sql

Start Gorgone debug push_gorgone_central_no_poller

# We wait for gorgone to be ready, and grab all file descriptor it need.
Sleep 20

Expand All @@ -35,9 +35,35 @@ check gorgone proxy do not leak file descriptor
Sleep 5
END

# disconnect the poller
check gorgone proxy do not leak file descriptor
[Tags] long_tests
[Teardown] Stop Gorgone And Remove Gorgone Config push_zmq_gorgone_central sql_file=${ROOT_CONFIG}db_delete_poller.sql
${cmd_count_file_descriptor}= Set Variable count=0; for pid in \$(ps aux | grep gorgone-proxy | grep -v grep | awk '{ print \$2 }') ; do num=\$(lsof | grep \$pid | wc -l); count=\$((count + \$num)) ; done ; echo \$count

Log To Console \nStarting the gorgone setup
Setup Two Gorgone Instances communication_mode=push_zmq central_name=push_zmq_gorgone_central poller_name=push_zmq_gorgone_poller_2
# We wait for gorgone to be ready, and grab all file descriptor it need.
Sleep 10
${before_kill_fd_nb} Run ${cmd_count_file_descriptor}
Stop Gorgone And Remove Gorgone Config push_gorgone_poller_2
Sleep 10
# check what is the normal number of file descriptor for gorgone to take
${initial_fd_nb} Run ${cmd_count_file_descriptor}
Log To Console \n number of file descriptor on before killing poller : ${before_kill_fd_nb} and after : ${initial_fd_nb} \n
${max}= Evaluate ${initial_fd_nb} + 15
Log To Console max is ${max}
Sleep 20
FOR ${i} IN RANGE 60
${current_fd_nb} Run ${cmd_count_file_descriptor}
IF ${i} % 10 == 0
Log To Console exec ${i} \t got ${current_fd_nb}
END
Should Be True ${max} > ${current_fd_nb} gorgone is using more and more file descriptor after a poller disconnect, starting at ${initial_fd_nb} and after ${i} iteration (5 sec each) to ${current_fd_nb}
Sleep 5
END



Log To Console End of tests.
*** Keywords ***

Start And Stop a Gorgone
Expand Down

0 comments on commit 7c317c6

Please sign in to comment.