Skip to content

Commit

Permalink
test: filter warnings for disabled instances
Browse files Browse the repository at this point in the history
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
  • Loading branch information
DifferentialOrange committed Oct 27, 2022
1 parent c8b379d commit 7baa481
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion test/suites/test_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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()

Expand All @@ -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()

Expand Down

0 comments on commit 7baa481

Please sign in to comment.