From 7baa48116e657b0b3b780d0f0d2d5f9f588284ef Mon Sep 17 00:00:00 2001 From: Georgy Moiseev Date: Mon, 24 Oct 2022 12:00:08 +0300 Subject: [PATCH] test: filter warnings for disabled instances There are several ConnectionPool tests that stop some pool instances and verify that everything works fine even for semi-functional cluster. Different network and cluster state warning are issued in this case. They are expected and not informative, thus it is better to filter them in final output. Closes #250 --- test/suites/test_pool.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/test/suites/test_pool.py b/test/suites/test_pool.py index bb475f48..5c5aaeb6 100644 --- a/test/suites/test_pool.py +++ b/test/suites/test_pool.py @@ -4,7 +4,14 @@ import warnings import tarantool -from tarantool.error import PoolTolopogyError, DatabaseError, NetworkError +from tarantool.error import ( + ClusterConnectWarning, + DatabaseError, + NetworkError, + NetworkWarning, + PoolTolopogyError, + PoolTolopogyWarning, +) from .lib.skip import skip_or_run_sql_test, skip_or_run_conn_pool_test from .lib.tarantool_server import TarantoolServer @@ -489,6 +496,9 @@ def test_12_execute(self): conn_0.close() def test_13_failover(self): + warnings.simplefilter('ignore', category=NetworkWarning) + warnings.simplefilter('ignore', category=PoolTolopogyWarning) + self.set_cluster_ro([False, True, True, True, True]) self.pool = tarantool.ConnectionPool( addrs=self.addrs, @@ -508,6 +518,8 @@ def expect_RW_request_execute_on_new_master(): self.retry(func=expect_RW_request_execute_on_new_master) def test_14_cluster_with_instances_dead_in_runtime_is_ok(self): + warnings.simplefilter('ignore', category=ClusterConnectWarning) + self.set_cluster_ro([False, True, False, True, True]) self.servers[0].stop() @@ -520,6 +532,8 @@ def test_14_cluster_with_instances_dead_in_runtime_is_ok(self): self.pool.ping(mode=tarantool.Mode.RW) def test_15_cluster_with_dead_instances_on_start_is_ok(self): + warnings.simplefilter('ignore', category=ClusterConnectWarning) + self.set_cluster_ro([False, True, True, True, True]) self.servers[0].stop()