Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mon 11220 unified sql #112

Merged
merged 123 commits into from
Dec 8, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
123 commits
Select commit Hold shift + click to select a range
360566d
wip(storage): attempt to make a rebuild message with protobuf
bouda1 Oct 11, 2021
025291c
wip(storage): new protobuf files added
bouda1 Oct 11, 2021
85a722b
wip(bbdo): serialization with protobuf
bouda1 Oct 12, 2021
a8a62b5
wip(storage): protobuf serialization
bouda1 Oct 12, 2021
f6110c1
wip(storage): serialization/deserialization work with bbdo.
bouda1 Oct 12, 2021
2e42384
cleanup(events_io): several warnings fixed
bouda1 Oct 13, 2021
e717004
fix(storage): rebuild with protobuf is better
bouda1 Oct 14, 2021
23f7bae
fix(storage): rebuild with grpc should almost work
bouda1 Oct 14, 2021
5bcdb9f
cleanup(collect): dos ascii => unix ascii and warnings removed.
bouda1 Oct 15, 2021
196b810
fix(storage): de_rebuild2 numeration must not be aligned with others …
bouda1 Oct 15, 2021
1509391
fix(rrd): this patch to fix a link error
bouda1 Oct 15, 2021
f6322ef
enh(cmake): protobuf events are a little better
bouda1 Nov 2, 2021
3b1c85b
fix(mysql): ping has a timeout now.
bouda1 Nov 2, 2021
b0a79a2
fix(cmake): unused files removed
bouda1 Nov 2, 2021
907b842
fix(cmake): protobuf dependencies are better now.
bouda1 Nov 3, 2021
e9322a7
wip(broker/unified_sql): first step for this new module
bouda1 Nov 3, 2021
5aa7c97
wip(broker/unified_sql): factory and connector should be ok
bouda1 Nov 3, 2021
e137de7
wip(unified_sql): conflict_manager a almost a stream now
bouda1 Nov 5, 2021
b12c96a
enh(unified_sql): this new module compiles
bouda1 Nov 5, 2021
74d650c
cleanup(neb): coding style applied on neb headers
bouda1 Nov 5, 2021
05fcdb8
cleanup(tests): coding style applied and warnings removed
bouda1 Nov 5, 2021
80fb6de
enh(protobuf): work on harmonization of events in collect
bouda1 Nov 5, 2021
35706f3
cleanup(various): coding style reapplied
bouda1 Nov 5, 2021
067ef3b
cleanup(various): coding style reapplied
bouda1 Nov 5, 2021
cf28576
fix(cmake/storage): no more needed hack removed
bouda1 Nov 5, 2021
aab8cfb
fix(connector/test): embedded_perl includes order
bouda1 Nov 5, 2021
24335d0
enh(broker/test): new unit test for unified_sql config
bouda1 Nov 5, 2021
4e97048
fix(unified_sql): a first working version.
bouda1 Nov 8, 2021
e94ca7a
enh(protobuf): namespace updated
bouda1 Nov 9, 2021
f84a908
enh(broker/config/state): bbdo_version introduced in configuration
bouda1 Nov 12, 2021
7701007
fix(bbdo/bbdo_version): It is no more a static value
bouda1 Nov 12, 2021
c23fd0f
fix(broker/storage): events are external to broker now
bouda1 Nov 12, 2021
16c7e12
enh(bbdo/protobuf): event generator script added
bouda1 Nov 12, 2021
6e546ee
fix(unified_sql): the unit test passes
bouda1 Nov 5, 2021
c904cc0
enh(storage/events): on the road of externalization
bouda1 Nov 13, 2021
1ef97cd
cleanup(parse_perfdata): the perfdata parser is moved to misc.
bouda1 Nov 15, 2021
ea408d9
fix(exceptions::perfdata): no more exceptions::perfdata exceptions
bouda1 Nov 15, 2021
3f0c47d
fix(parse_perfdata): does not thrw exception anymore and changed api
bouda1 Nov 15, 2021
2eb2a74
fix(misc::parse_perfdata): this fix is needed because of another func…
bouda1 Nov 16, 2021
62db314
wip(broker): Just tests commented to have something that compiles
bouda1 Nov 16, 2021
2b62fd4
fix(cmake): compilation is back and in C++14 with cmake3
bouda1 Nov 16, 2021
617d8cc
fix(broker/unified_sql/test): code re-established
bouda1 Nov 16, 2021
92074d7
cleanup(broker/events): coding style and optimization
bouda1 Nov 16, 2021
af2232f
fix(broker/stats/tests): A test is disabled.
bouda1 Nov 16, 2021
8649081
fix(bam): bam event types are stored in bbdo folder now.
bouda1 Nov 17, 2021
77d65df
fix(broker/bam): bam events are moved to bbdo.
bouda1 Nov 17, 2021
a8e0825
enh(cmake): bbdo events are faster to compile
bouda1 Nov 17, 2021
dd53e1e
fix(broker/unified_sql): Thread is started and unified_sql works now.
bouda1 Nov 18, 2021
578cd2d
fix(unified_sql): mfifo was still read from two inputs.
bouda1 Nov 18, 2021
c07758d
fix(unified_sql): mfifo removed from stream
bouda1 Nov 19, 2021
c0cbbf4
fix(broker/unified_sql): events badly acknowledged
bouda1 Nov 19, 2021
b74fead
fix(broker/unified_sql): acknowledgement is better now
bouda1 Nov 19, 2021
cedb632
fix(broker/unified_sql): not needed stat removed
bouda1 Nov 20, 2021
75d7c67
enh(broker/notification): This module is no more used.
bouda1 Nov 20, 2021
ce6c83d
cleanup(hook): tests about them are also removed
bouda1 Nov 22, 2021
b2c0b4c
fix(broker/hook): hook and hookers are removed.
bouda1 Nov 22, 2021
eb7101a
cleanup(broker/tets): tests on engine are more apropriate to gtest
bouda1 Nov 22, 2021
d5d544e
enh(broker/engine): attempt to simplify and optimize engine
bouda1 Nov 22, 2021
67a31ae
fix(unified_sql): no more thread in unified_sql
bouda1 Nov 23, 2021
40b98d1
enh(broker/unified_sql): indices/metrics deletion re-enabled.
bouda1 Nov 23, 2021
1c9ed0f
fix(broker/remove_graph): it works also with unified_sql
bouda1 Nov 23, 2021
e7e9be2
enh(robot/broker): new test for unified_sql
bouda1 Nov 24, 2021
05e296f
wip(broker/tests): try to fix the issue with duplicated events
bouda1 Nov 29, 2021
4604c95
fix(broker/status): status events could be sent several times
bouda1 Nov 30, 2021
51e52e6
cleanup(broker/kpi_event.hh): unused functions removed.
bouda1 Nov 30, 2021
33a1287
fix(bbdo/generate-accessor.py): several fixes in the python script.
bouda1 Nov 30, 2021
27fbd74
cleanup(bbdo/metric.hh): comments removed
bouda1 Nov 30, 2021
7abf99d
cleanup(broker/kpi.hh): coding style applied.
bouda1 Nov 30, 2021
b5b42ce
fix(broker/io): comment removed in events.hh
bouda1 Nov 30, 2021
bfadcb7
cleanup(broker/io::protobuf): comments added.
bouda1 Dec 1, 2021
ec4dce5
cleanup(broker/brokerrpc): new comments
bouda1 Dec 1, 2021
93184d1
fix(broker/lua): no need anymore of bam module.
bouda1 Dec 1, 2021
03e6e7f
cleanup(broker/lua): coding style applied on main.cc
bouda1 Dec 1, 2021
c8c5067
cleanup(broker/rrd): coding style
bouda1 Dec 1, 2021
bcbf34f
fix(broker/lua/simu): tests re-enabled
bouda1 Dec 1, 2021
a182b4a
fix(broker/mysql_connection): mysql_ping must be called just when needed
bouda1 Dec 1, 2021
809b658
fix(tests/broker-database): tests are more stable
bouda1 Dec 1, 2021
534fb37
fix(tests/broker-database): Two timeouts are set to greater values
bouda1 Dec 1, 2021
943059e
fix(cmake): table_max_size file generation dependency fixed
bouda1 Dec 1, 2021
a48a693
fix(cmake): dependency added
bouda1 Dec 1, 2021
c2d4c3a
fix(packaging): new spec file
bouda1 Dec 2, 2021
dd5f198
fix(cmake): clib library should have a better place
bouda1 Dec 2, 2021
7bb8558
wip(packaging): new packaging almost finished
bouda1 Dec 3, 2021
9e7e743
fix(cmake/connector): two rpm added
bouda1 Dec 3, 2021
fa147d7
fix(cmake/packaging): collect is packaged in one step
bouda1 Dec 3, 2021
31f8e6e
fix(cmake/packaging): rsync not on the ci
bouda1 Dec 4, 2021
76eecd9
fix(cmake/packaging): this is shorter and better
bouda1 Dec 4, 2021
c3c4074
fix(cmake/packaging): typo
bouda1 Dec 4, 2021
b2f5bff
fix(packagine/specfile): file packaged twice
bouda1 Dec 4, 2021
9d826b6
fix(packaging/script): bad path to the spec file
bouda1 Dec 4, 2021
47eb7e6
fix(cmake/packaging): new debug message
bouda1 Dec 4, 2021
ad05d10
fix(packaging/script): variable not interpreted
bouda1 Dec 4, 2021
e9151f6
fix(cmake/engine): No need to look for centreon-clib
bouda1 Dec 4, 2021
85d9bd3
fix(cmake/connector): no need to look for the clib
bouda1 Dec 4, 2021
af438b6
fix(packaging/clib): its detection is useless
bouda1 Dec 4, 2021
6b34c6c
fix(packaging/debian): clib files changed path
bouda1 Dec 4, 2021
fc8e050
fix(packaging/debian): centreon-clib.pc is no more distributed
bouda1 Dec 5, 2021
f3c8cf3
fix(packaging/debian): bad paths fixed
bouda1 Dec 5, 2021
97e8545
fix(packaging/debian): missing files fixed
bouda1 Dec 5, 2021
1a9b938
fix(packaging/debian): a bad path fixed again
bouda1 Dec 5, 2021
f90e87a
fix(packaging/rpm): unused variables removed
bouda1 Dec 5, 2021
d6df6d2
cleanup(packaging/clib): this is no more used
bouda1 Dec 5, 2021
f23eb59
fix(packaging/engine): old packaging removed
bouda1 Dec 5, 2021
be8499b
fix(packaging): last changes
bouda1 Dec 5, 2021
d21a46e
fix(packaging/debian): little update of the packagin script
bouda1 Dec 6, 2021
1630a32
fix(packagine/rpm): centreon-engine user not defined
bouda1 Dec 6, 2021
8e8d875
fix(packaging/global): services had old conf variables
bouda1 Dec 6, 2021
a74241c
fix(packaging/debian): the distrib directory could fail
bouda1 Dec 6, 2021
684ff74
fix(tests/resources): two little fixes in specific-duplication.py
bouda1 Dec 6, 2021
9b8d1b4
fix(packaging/rpm): services should be better
bouda1 Dec 6, 2021
9cf5969
fix(various): several remarks fixed after PR review
bouda1 Dec 6, 2021
0806e81
fix(packaging): let's try to make paths more standard
bouda1 Dec 6, 2021
e256800
fix(packagine/connectors): standard paths are used
bouda1 Dec 6, 2021
557921b
fix(packaging): paths become standard
bouda1 Dec 7, 2021
a7c4ce0
fix(packaging): absolute paths for sbin were missing
bouda1 Dec 7, 2021
3b1e801
fix(broker/influxdb/graphite): compilation errors fixed
bouda1 Dec 7, 2021
74e7e55
fix(packaging/debian): bad variables definitions
bouda1 Dec 7, 2021
cf2a388
fix(broker/config): new errors when a directory is not accessible
bouda1 Dec 7, 2021
7ec2612
fix(cmake/libdir): libdir changes from a distrib to another
bouda1 Dec 7, 2021
541cc53
fix(packaging/debian): libdir has changed
bouda1 Dec 7, 2021
1de398a
fix(packaging/debian): bad paths in debian packaging
bouda1 Dec 7, 2021
c148aaf
fix(broker/config/test): the parser checks paths now
bouda1 Dec 7, 2021
b07fd65
fix(broker/test): the parser failed because of new checks
bouda1 Dec 7, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(broker/mysql_connection): mysql_ping must be called just when needed
  • Loading branch information
bouda1 committed Dec 3, 2021
commit a182b4a6366202c18c770bfd9831fcd3df81f560
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class mysql_connection {
std::list<std::unique_ptr<database::mysql_task>> _tasks_list;
std::atomic_int _tasks_count;
bool _need_commit;
std::time_t _last_access;

std::unordered_map<uint32_t, MYSQL_STMT*> _stmt;
std::unordered_map<uint32_t, std::string> _stmt_query;
Expand Down
23 changes: 15 additions & 8 deletions centreon-broker/core/src/mysql_connection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ bool mysql_connection::_try_to_reconnect() {
"mysql_connection: The mysql/mariadb database seems not started.");
return false;
}
_last_access = std::time(nullptr);

_prepare_connection();

Expand Down Expand Up @@ -224,6 +225,8 @@ void mysql_connection::_commit(mysql_task* t) {
log_v2::sql()->error("mysql_connection: {}", err_msg);
std::this_thread::sleep_for(std::chrono::milliseconds(50));
}
if (res == 0)
_last_access = std::time(nullptr);
} else
res = 0;

Expand Down Expand Up @@ -586,6 +589,7 @@ void mysql_connection::_run() {
_start_condition.notify_all();
return;
}
_last_access = std::time(nullptr);
}

if (config::applier::mode == config::applier::finished) {
Expand Down Expand Up @@ -616,22 +620,25 @@ void mysql_connection::_run() {
static_cast<int>(_tasks_count));
/* We are waiting for some activity, nothing to do for now it is time
* to make some ping */
while (!_tasks_condition.wait_for(
lock, std::chrono::seconds(30),
[this] { return _finish_asked || !_tasks_list.empty(); })) {
_tasks_condition.wait(
lock,
[this] { return _finish_asked || !_tasks_list.empty(); });

std::time_t now = std::time(nullptr);;
if (_tasks_list.empty())
_state = finished;
else if (now >= _last_access + 30) {
lock.unlock();
log_v2::sql()->trace("SQL: performing mysql_ping.");
if (mysql_ping(_conn)) {
if (!_try_to_reconnect())
log_v2::sql()->error("SQL: Reconnection failed.");
} else
} else {
log_v2::sql()->trace("SQL: connection always alive");
_last_access = now;
}
lock.lock();
}

if (_tasks_list.empty()) {
_state = finished;
}
continue;
}

Expand Down
218 changes: 174 additions & 44 deletions centreon-tests/broker-database/networkFailure.robot
Original file line number Diff line number Diff line change
@@ -1,64 +1,194 @@
*** Settings ***
Resource ../resources/resources.robot
Suite Setup Clean Before Suite
Suite Teardown Clean After Suite
Test Setup Stop Processes
Resource ../resources/resources.robot
Suite Setup Clean Before Suite
Suite Teardown Clean After Suite
Test Setup Stop Processes

Documentation Centreon Broker database connection failure
Library Process
Library DateTime
Library OperatingSystem
Library ../resources/BrokerDatabase.py
Library ../resources/Common.py
Library ../resources/Broker.py
Library ../resources/Engine.py
Documentation Centreon Broker database connection failure
Library Process
Library DateTime
Library OperatingSystem
Library ../resources/Common.py
Library ../resources/Broker.py
Library ../resources/Engine.py

*** Test Cases ***
NetworkDbFail1
[Documentation] network failure test between broker and database (shutting down connection for 100ms)
[Tags] Broker Database Network
Network Failure interval=100ms
[Documentation] network failure test between broker and database (shutting down connection for 100ms)
[Tags] Broker Database Network
Network Failure interval=100ms

NetworkDbFail2
[Documentation] network failure test between broker and database (shutting down connection for 1s)
[Tags] Broker Database Network
Network Failure interval=1s
[Documentation] network failure test between broker and database (shutting down connection for 1s)
[Tags] Broker Database Network
Network Failure interval=1s

NetworkDbFail3
[Documentation] network failure test between broker and database (shutting down connection for 10s)
[Tags] Broker Database Network
Network Failure interval=10s
[Documentation] network failure test between broker and database (shutting down connection for 10s)
[Tags] Broker Database Network
Network Failure interval=10s

NetworkDbFail4
[Documentation] network failure test between broker and database (shutting down connection for 30s)
[Tags] Broker Database Network
Network Failure interval=30s
[Documentation] network failure test between broker and database (shutting down connection for 30s)
[Tags] Broker Database Network
Network Failure interval=30s

NetworkDbFail5
[Documentation] network failure test between broker and database (shutting down connection for 60s)
[Tags] Broker Database Network
Network Failure interval=1m
[Documentation] network failure test between broker and database (shutting down connection for 60s)
[Tags] Broker Database Network
Network Failure interval=1m

NetworkDBFail6
[Documentation] network failure test between broker and database: we wait for the connection to be established and then we shut down the connection for 60s
[Tags] Broker Database Network
Config Engine ${1}
Config Broker central
Broker Config Output Set central central-broker-master-sql db_host 127.0.0.1
Broker Config Output set central central-broker-master-sql connections_count 5
Broker Config Output Set central central-broker-master-perfdata db_host 127.0.0.1
Broker Config Output set central central-broker-master-perfdata connections_count 5
Broker Config Log central sql trace
Config Broker rrd
Config Broker module
${start}= Get Current Date
Start Broker
Start Engine
${result}= Check Connections
Should Be True ${result} msg=Broker and Engine are not connected
${content}= Create List run query: SELECT
${result}= Find In Log With Timeout ${logCbd} ${start} ${content} 40
Should Be True ${result} msg=No SELECT done by broker in the DB
Disable Eth Connection On Port port=3306
Sleep 1m
Reset Eth Connection
${content}= Create List 0 events acknowledged
${result}= Find In Log With Timeout ${logCbd} ${start} ${content} 40
Stop Engine
Stop Broker

NetworkDBFailU6
[Documentation] network failure test between broker and database: we wait for the connection to be established and then we shut down the connection for 60s (with unified_sql)
[Tags] Broker Database Network unified_sql
Config Engine ${1}
Config Broker central
Config Broker Sql Output central unified_sql
Broker Config Output Set central central-broker-unified-sql db_host 127.0.0.1
Broker Config Output set central central-broker-master-sql connections_count 5
Broker Config Log central sql trace
Config Broker rrd
Config Broker module
${start}= Get Current Date
Start Broker
Start Engine
${result}= Check Connections
Should Be True ${result} msg=Broker and Engine are not connected
${content}= Create List run query: SELECT
${result}= Find In Log With Timeout ${logCbd} ${start} ${content} 40
Should Be True ${result} msg=No SELECT done by broker in the DB
Disable Eth Connection On Port port=3306
Sleep 1m
Reset Eth Connection
${content}= Create List 0 events acknowledged
${result}= Find In Log With Timeout ${logCbd} ${start} ${content} 40
Stop Engine
Stop Broker

NetworkDBFail7
[Documentation] network failure test between broker and database: we wait for the connection to be established and then we shut down the connection for 60s
[Tags] Broker Database Network
Config Engine ${1}
Config Broker central
Reset Eth Connection
Broker Config Output Set central central-broker-master-sql db_host 127.0.0.1
Broker Config Output set central central-broker-master-sql connections_count 5
Broker Config Output Set central central-broker-master-perfdata db_host 127.0.0.1
Broker Config Output set central central-broker-master-perfdata connections_count 5
Broker Config Log central sql trace
Config Broker rrd
Config Broker module
${start}= Get Current Date
Start Broker
Start Engine
${result}= Check Connections
Should Be True ${result} msg=Broker and Engine are not connected
${content}= Create List run query: SELECT
${result}= Find In Log With Timeout ${logCbd} ${start} ${content} 40
Should Be True ${result} msg=No SELECT done by broker in the DB
FOR ${i} IN 0 5
Disable Eth Connection On Port port=3306
Sleep 10s
Reset Eth Connection
Sleep 10s
END
${content}= Create List 0 events acknowledged
${result}= Find In Log With Timeout ${logCbd} ${start} ${content} 40
Should Be True ${result} msg=No SELECT done by broker in the DB
Stop Engine
Stop Broker

NetworkDBFailU7
[Documentation] network failure test between broker and database: we wait for the connection to be established and then we shut down the connection for 60s (with unified_sql)
[Tags] Broker Database Network unified_sql
Config Engine ${1}
Config Broker central
Config Broker Sql Output central unified_sql
Reset Eth Connection
Broker Config Output Set central central-broker-unified-sql db_host 127.0.0.1
Broker Config Output set central central-broker-unified-sql connections_count 5
Broker Config Log central sql trace
Config Broker rrd
Config Broker module
${start}= Get Current Date
Start Broker
Start Engine
${result}= Check Connections
Should Be True ${result} msg=Broker and Engine are not connected
${content}= Create List run query: SELECT
${result}= Find In Log With Timeout ${logCbd} ${start} ${content} 40
Should Be True ${result} msg=No SELECT done by broker in the DB
FOR ${i} IN 0 5
Disable Eth Connection On Port port=3306
Sleep 10s
Reset Eth Connection
Sleep 10s
END
${content}= Create List 0 events acknowledged
${result}= Find In Log With Timeout ${logCbd} ${start} ${content} 40
Should Be True ${result} msg=No SELECT done by broker in the DB
Stop Engine
Stop Broker

*** Keywords ***
Disable Sleep Enable
[Arguments] ${interval}
Disable Eth Connection On Port port=3306
Sleep ${interval}
Sleep ${interval}
Reset Eth Connection

Network Failure
[Arguments] ${interval}
[Arguments] ${interval}
Config Engine ${1}
Config Broker central
Broker Config Output Set central central-broker-master-sql db_host 127.0.0.1
Broker Config Log central sql trace
${start}= Get Current Date
Start mysql
Start Broker
Config Broker module
Config Broker rrd
Config Broker central
Broker Config Output Set central central-broker-master-sql db_host 127.0.0.1
Broker Config Output set central central-broker-master-sql connections_count 5
Broker Config Output Set central central-broker-master-perfdata db_host 127.0.0.1
Broker Config Output set central central-broker-master-perfdata connections_count 5
Broker Config Log central sql trace
${start}= Get Current Date
Start Broker
Start Engine
${log}= Catenate SEPARATOR= ${BROKER_LOG} /central-broker-master.log
${content}= Set Variable SQL: performing mysql_ping.
${result}= Do When Catch In Log ${log} ${start} ${content} Disable Sleep Enable ${interval}
${end}= Get Current Date
${content}= Set Variable mysql_connection: commit
Should Not Be Equal ${result} False msg=timeout after 5 minutes (network failure duration : ${interval})
${result}= Catch In Log ${log} ${end} ${content}
Should Be True ${result} msg=timeout after 5 minutes (mysql_ping may be hanging)
${content}= Create List SQL: performing mysql_ping
${result}= Find In Log With Timeout ${logCbd} ${start} ${content} 50
Should Be True ${result} msg=We should have a call to mysql_ping every 30s on inactive connections.
Disable Sleep Enable ${interval}
${end}= Get Current Date
${content}= Create List mysql_connection: commit
${result}= Find In Log With Timeout ${logCbd} ${end} ${content} 80
Should Be True ${result} msg=timeout after network to be restablished (network failure duration : ${interval})
Stop Broker
Stop Engine
Stop Mysql

*** Variables ***
${logCbd} ${BROKER_LOG}/central-broker-master.log
1 change: 1 addition & 0 deletions centreon-tests/broker-engine/rrd.robot
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Library ../resources/Common.py

*** Test Cases ***
BRRDDM1
Start Mysql
[Documentation] RRD metric deletion on table metric
[Tags] RRD metric deletion on table metric
Config Engine ${1}
Expand Down
23 changes: 0 additions & 23 deletions centreon-tests/resources/BrokerDatabase.py

This file was deleted.

8 changes: 4 additions & 4 deletions centreon-tests/resources/Common.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def get_date(d: str):


def find_in_log_with_timeout(log: str, date, content, timeout: int):
limit = time.time() + TIMEOUT
limit = time.time() + timeout
while time.time() < limit:
if find_in_log(log, date, content):
return True
Expand Down Expand Up @@ -118,12 +118,12 @@ def stop_mysql():


def kill_broker():
getoutput("kill -SIGTERM $(ps aux | grep '/usr/sbin/cbwd' | grep -v grep | awk '{print $2}')")
getoutput("kill -SIGTERM $(ps aux | grep '/usr/sbin/cbd' | grep -v grep | awk '{print $2}')")
getoutput("kill -SIGKILL $(ps aux | grep '/usr/sbin/cbwd' | grep -v grep | awk '{print $2}')")
getoutput("kill -SIGKILL $(ps aux | grep '/usr/sbin/cbd' | grep -v grep | awk '{print $2}')")


def kill_engine():
getoutput("kill -SIGTERM $(ps aux | grep '/usr/sbin/centengine' | grep -v grep | awk '{print $2}')")
getoutput("kill -SIGKILL $(ps aux | grep '/usr/sbin/centengine' | grep -v grep | awk '{print $2}')")


def clear_retention():
Expand Down
7 changes: 4 additions & 3 deletions centreon-tests/resources/resources.robot
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ Reload Broker
Send Signal To Process SIGHUP b2

Stop Broker
${result}= Terminate Process b1
Log to console Extinction of b1
${result}= Terminate Process b1 kill=False
Should Be Equal As Integers ${result.rc} 0
${result}= Terminate Process b2
${result}= Terminate Process b2 kill=False
Should Be Equal As Integers ${result.rc} 0

Stop Processes
Expand Down Expand Up @@ -84,7 +85,7 @@ Check Connections
[Return] ${retval}

Disable Eth Connection On Port
[Arguments] ${port}
[Arguments] ${port}
RUN iptables -A INPUT -p tcp --dport ${port} -j DROP
RUN iptables -A OUTPUT -p tcp --dport ${port} -j DROP
RUN iptables -A FORWARD -p tcp --dport ${port} -j DROP
Expand Down