Vladsz83 commented on a change in pull request #8159:
URL: https://github.com/apache/ignite/pull/8159#discussion_r473777224
##########
File path: modules/ducktests/tests/ignitetest/tests/discovery_test.py
##########
@@ -91,81 +96,57 @@ def setUp(self):
pass
def teardown(self):
- if self.zk_quorum:
- self.zk_quorum.stop()
+ if self.loader:
+ self.loader.stop()
if self.servers:
self.servers.stop()
- @cluster(num_nodes=NUM_NODES)
- @parametrize(version=str(DEV_BRANCH))
- @parametrize(version=str(LATEST_2_7))
- def test_tcp_not_coordinator_single(self, version):
- """
- Test single-node-failure scenario (not the coordinator) with
TcpDiscoverySpi.
- """
- return self.__simulate_nodes_failure(version, self.__properties(), 1)
-
- @cluster(num_nodes=NUM_NODES)
- @parametrize(version=str(DEV_BRANCH))
- @parametrize(version=str(LATEST_2_7))
- def test_tcp_not_coordinator_two(self, version):
- """
- Test two-node-failure scenario (not the coordinator) with
TcpDiscoverySpi.
- """
- return self.__simulate_nodes_failure(version, self.__properties(), 2)
+ if self.zk_quorum:
+ self.zk_quorum.stop()
@cluster(num_nodes=NUM_NODES)
- @parametrize(version=str(DEV_BRANCH))
- @parametrize(version=str(LATEST_2_7))
- def test_tcp_coordinator(self, version):
- """
- Test coordinator-failure scenario with TcpDiscoverySpi.
- """
- return self.__simulate_nodes_failure(version, self.__properties(), 0)
-
- @cluster(num_nodes=NUM_NODES + 3)
- @parametrize(version=str(DEV_BRANCH))
- @parametrize(version=str(LATEST_2_7))
- def test_zk_not_coordinator_single(self, version):
+ @matrix(ignite_version=[str(DEV_BRANCH), str(LATEST_2_8)],
+ kill_coordinator=[False, True],
+ nodes_to_kill=[0, 1, 2],
+ with_load=[False, True])
+ def test_tcp(self, ignite_version, kill_coordinator, nodes_to_kill,
with_load):
"""
- Test single node failure scenario (not the coordinator) with ZooKeeper.
+ Test nodes failure scenario with TcpDiscoverySpi.
"""
- self.__start_zk_quorum()
-
- return self.__simulate_nodes_failure(version,
self.__zk_properties(self.zk_quorum.connection_string()), 1)
+ return self.__simulate_nodes_failure(ignite_version,
self.__properties(), None, kill_coordinator,
+ nodes_to_kill, with_load)
@cluster(num_nodes=NUM_NODES + 3)
- @parametrize(version=str(DEV_BRANCH))
- @parametrize(version=str(LATEST_2_7))
- def test_zk_not_coordinator_two(self, version):
+ @matrix(ignite_version=[str(DEV_BRANCH), str(LATEST_2_8)],
+ kill_coordinator=[False, True],
+ nodes_to_kill=[0, 1, 2],
+ with_load=[False, True])
+ def test_zk(self, ignite_version, kill_coordinator, nodes_to_kill,
with_load):
"""
- Test two-node-failure scenario (not the coordinator) with ZooKeeper.
+ Test node failure scenario with ZooKeeperSpi.
"""
self.__start_zk_quorum()
- return self.__simulate_nodes_failure(version,
self.__zk_properties(self.zk_quorum.connection_string()), 2)
+ properties = self.__zk_properties(self.zk_quorum.connection_string())
+ modules = ["zookeeper"]
- @cluster(num_nodes=NUM_NODES+3)
- @parametrize(version=str(DEV_BRANCH))
- @parametrize(version=str(LATEST_2_7))
- def test_zk_coordinator(self, version):
- """
- Test coordinator-failure scenario with ZooKeeper.
- """
- self.__start_zk_quorum()
+ return self.__simulate_nodes_failure(ignite_version, properties,
modules, kill_coordinator, nodes_to_kill,
+ with_load)
- return self.__simulate_nodes_failure(version,
self.__zk_properties(self.zk_quorum.connection_string()), 0)
+ def __simulate_nodes_failure(self, version, properties, modules,
kill_coordinator=False, nodes_to_kill=1,
+ with_load=False):
+ if nodes_to_kill == 0 and not kill_coordinator:
+ return {"No nodes to kill": "Nothing to do"}
- def __simulate_nodes_failure(self, version, properties, nodes_to_kill=1):
"""
Review comment:
Did some reallocations. Looks well to me.
##########
File path: modules/ducktests/tests/ignitetest/tests/discovery_test.py
##########
@@ -91,81 +96,57 @@ def setUp(self):
pass
def teardown(self):
- if self.zk_quorum:
- self.zk_quorum.stop()
+ if self.loader:
+ self.loader.stop()
if self.servers:
self.servers.stop()
- @cluster(num_nodes=NUM_NODES)
- @parametrize(version=str(DEV_BRANCH))
- @parametrize(version=str(LATEST_2_7))
- def test_tcp_not_coordinator_single(self, version):
- """
- Test single-node-failure scenario (not the coordinator) with
TcpDiscoverySpi.
- """
- return self.__simulate_nodes_failure(version, self.__properties(), 1)
-
- @cluster(num_nodes=NUM_NODES)
- @parametrize(version=str(DEV_BRANCH))
- @parametrize(version=str(LATEST_2_7))
- def test_tcp_not_coordinator_two(self, version):
- """
- Test two-node-failure scenario (not the coordinator) with
TcpDiscoverySpi.
- """
- return self.__simulate_nodes_failure(version, self.__properties(), 2)
+ if self.zk_quorum:
+ self.zk_quorum.stop()
@cluster(num_nodes=NUM_NODES)
- @parametrize(version=str(DEV_BRANCH))
- @parametrize(version=str(LATEST_2_7))
- def test_tcp_coordinator(self, version):
- """
- Test coordinator-failure scenario with TcpDiscoverySpi.
- """
- return self.__simulate_nodes_failure(version, self.__properties(), 0)
-
- @cluster(num_nodes=NUM_NODES + 3)
- @parametrize(version=str(DEV_BRANCH))
- @parametrize(version=str(LATEST_2_7))
- def test_zk_not_coordinator_single(self, version):
+ @matrix(ignite_version=[str(DEV_BRANCH), str(LATEST_2_8)],
+ kill_coordinator=[False, True],
+ nodes_to_kill=[0, 1, 2],
+ with_load=[False, True])
+ def test_tcp(self, ignite_version, kill_coordinator, nodes_to_kill,
with_load):
"""
- Test single node failure scenario (not the coordinator) with ZooKeeper.
+ Test nodes failure scenario with TcpDiscoverySpi.
"""
- self.__start_zk_quorum()
-
- return self.__simulate_nodes_failure(version,
self.__zk_properties(self.zk_quorum.connection_string()), 1)
+ return self.__simulate_nodes_failure(ignite_version,
self.__properties(), None, kill_coordinator,
+ nodes_to_kill, with_load)
@cluster(num_nodes=NUM_NODES + 3)
- @parametrize(version=str(DEV_BRANCH))
- @parametrize(version=str(LATEST_2_7))
- def test_zk_not_coordinator_two(self, version):
+ @matrix(ignite_version=[str(DEV_BRANCH), str(LATEST_2_8)],
+ kill_coordinator=[False, True],
+ nodes_to_kill=[0, 1, 2],
+ with_load=[False, True])
+ def test_zk(self, ignite_version, kill_coordinator, nodes_to_kill,
with_load):
"""
- Test two-node-failure scenario (not the coordinator) with ZooKeeper.
+ Test node failure scenario with ZooKeeperSpi.
"""
self.__start_zk_quorum()
- return self.__simulate_nodes_failure(version,
self.__zk_properties(self.zk_quorum.connection_string()), 2)
+ properties = self.__zk_properties(self.zk_quorum.connection_string())
+ modules = ["zookeeper"]
- @cluster(num_nodes=NUM_NODES+3)
- @parametrize(version=str(DEV_BRANCH))
- @parametrize(version=str(LATEST_2_7))
- def test_zk_coordinator(self, version):
- """
- Test coordinator-failure scenario with ZooKeeper.
- """
- self.__start_zk_quorum()
+ return self.__simulate_nodes_failure(ignite_version, properties,
modules, kill_coordinator, nodes_to_kill,
+ with_load)
- return self.__simulate_nodes_failure(version,
self.__zk_properties(self.zk_quorum.connection_string()), 0)
+ def __simulate_nodes_failure(self, version, properties, modules,
kill_coordinator=False, nodes_to_kill=1,
+ with_load=False):
+ if nodes_to_kill == 0 and not kill_coordinator:
+ return {"No nodes to kill": "Nothing to do"}
- def __simulate_nodes_failure(self, version, properties, nodes_to_kill=1):
"""
:param nodes_to_kill: How many nodes to kill. If <1, the coordinator
is the choice. Otherwise: not-coordinator
nodes of given number.
"""
self.servers = IgniteService(
self.test_context,
- num_nodes=self.NUM_NODES,
- modules=["zookeeper"],
+ num_nodes=self.NUM_NODES - 1 if with_load else self.NUM_NODES,
Review comment:
Fixed
##########
File path: modules/ducktests/tests/ignitetest/tests/discovery_test.py
##########
@@ -230,17 +218,38 @@ def __simulate_nodes_failure(self, version, properties,
nodes_to_kill=1):
def __failed_pattern(failed_node_id):
return "Node FAILED: .\\{1,\\}Node \\[id=" + failed_node_id
- def __choose_node_to_kill(self, nodes_to_kill):
+ def __choose_node_to_kill(self, kill_coordinator, nodes_to_kill):
nodes = self.servers.nodes
coordinator = nodes[0].discovery_info().coordinator
+ to_kill = []
- if nodes_to_kill < 1:
- to_kill = next(node for node in nodes if
node.discovery_info().node_id == coordinator)
- else:
- to_kill = random.sample([n for n in nodes if
n.discovery_info().node_id != coordinator], nodes_to_kill)
+ if kill_coordinator:
+ to_kill.append(next(node for node in nodes if
node.discovery_info().node_id == coordinator))
- to_kill = [to_kill] if not isinstance(to_kill, list) else to_kill
+ if nodes_to_kill > 0:
+ choice = random.sample([n for n in nodes if
n.discovery_info().node_id != coordinator], nodes_to_kill)
+ to_kill.extend([choice] if not isinstance(choice, list) else
choice)
survive = random.choice([node for node in self.servers.nodes if node
not in to_kill])
return to_kill, survive
+
+ def __start_loading(self, ignite_version, properties, modules, wait_sec=0):
+ self.stage("Starting loading")
+
+ self.loader = IgniteApplicationService(
+ self.test_context,
+
java_class_name="org.apache.ignite.internal.ducktest.tests.DataGenerationApplication",
+ version=ignite_version,
+ modules=modules,
+ properties=properties,
+ params={"cacheName": "test-cache", "range": self.__DATA_AMOUNT,
"infinite": True, "optimized": False})
+
+ self.loader.start()
+
+ for node in self.loader.nodes:
+ self.loader.await_event_on_node("Begin generating data in
background...", node, 10, True, 1)
Review comment:
Fixed
##########
File path: modules/ducktests/tests/ignitetest/tests/discovery_test.py
##########
@@ -230,17 +218,38 @@ def __simulate_nodes_failure(self, version, properties,
nodes_to_kill=1):
def __failed_pattern(failed_node_id):
return "Node FAILED: .\\{1,\\}Node \\[id=" + failed_node_id
- def __choose_node_to_kill(self, nodes_to_kill):
+ def __choose_node_to_kill(self, kill_coordinator, nodes_to_kill):
nodes = self.servers.nodes
coordinator = nodes[0].discovery_info().coordinator
+ to_kill = []
- if nodes_to_kill < 1:
- to_kill = next(node for node in nodes if
node.discovery_info().node_id == coordinator)
- else:
- to_kill = random.sample([n for n in nodes if
n.discovery_info().node_id != coordinator], nodes_to_kill)
+ if kill_coordinator:
+ to_kill.append(next(node for node in nodes if
node.discovery_info().node_id == coordinator))
- to_kill = [to_kill] if not isinstance(to_kill, list) else to_kill
+ if nodes_to_kill > 0:
+ choice = random.sample([n for n in nodes if
n.discovery_info().node_id != coordinator], nodes_to_kill)
+ to_kill.extend([choice] if not isinstance(choice, list) else
choice)
survive = random.choice([node for node in self.servers.nodes if node
not in to_kill])
return to_kill, survive
+
+ def __start_loading(self, ignite_version, properties, modules, wait_sec=0):
+ self.stage("Starting loading")
+
+ self.loader = IgniteApplicationService(
+ self.test_context,
+
java_class_name="org.apache.ignite.internal.ducktest.tests.DataGenerationApplication",
+ version=ignite_version,
+ modules=modules,
+ properties=properties,
+ params={"cacheName": "test-cache", "range": self.__DATA_AMOUNT,
"infinite": True, "optimized": False})
+
+ self.loader.start()
+
+ for node in self.loader.nodes:
+ self.loader.await_event_on_node("Begin generating data in
background...", node, 10, True, 1)
+
+ if wait_sec > 0:
+ self.logger.info("Waiting for the data load for " + str(wait_sec)
+ " seconds...")
Review comment:
Fixed
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]