Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,13 @@ def int_order(self):
val = self.__find__("intOrder=(\\d+),")
return int(val) if val else -1

@property
def is_coordinator(self):
"""
:return: True if node is coordinator. False otherwise.
"""
return self.coordinator == self.node_id

def __find__(self, pattern):
res = re.search(pattern, self._local_raw)
return res.group(1) if res else None
Expand Down
18 changes: 18 additions & 0 deletions modules/ducktests/tests/ignitetest/tests/network_group/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""
This package contains MDC tests.
"""
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from ignitetest.services.ignite import IgniteService
from ignitetest.services.utils.ignite_configuration import IgniteConfiguration
from ignitetest.utils import ignite_versions, cluster
from ignitetest.utils.ignite_test import IgniteTest
from ignitetest.utils.version import DEV_BRANCH, IgniteVersion

DC_1_NAME = "DC1"
DC_2_NAME = "DC2"

class MultiDCTest(IgniteTest):
@cluster(num_nodes=3)
@ignite_versions(str(DEV_BRANCH))
def test_coordinator_change(self, ignite_version):
ign_cfg = IgniteConfiguration(version=IgniteVersion(ignite_version))

jvm_opts_dc_1 = [f"-DIGNITE_DATA_CENTER_ID={DC_1_NAME}"]
jvm_opts_dc_2 = [f"-DIGNITE_DATA_CENTER_ID={DC_2_NAME}"]

self.svc_dc_1_crd = IgniteService(self.test_context, ign_cfg, num_nodes=1, jvm_opts=jvm_opts_dc_1)
self.svc_dc_1_crd_sub = IgniteService(self.test_context, ign_cfg, num_nodes=1, jvm_opts=jvm_opts_dc_1)
self.svc_dc_2 = IgniteService(self.test_context, ign_cfg, num_nodes=1, jvm_opts=jvm_opts_dc_2)

for svc in [self.svc_dc_1_crd, self.svc_dc_2]:
svc.start()

self.svc_dc_1_crd_sub.start()

self.is_coordinator(self.svc_dc_1_crd, 0)

self.svc_dc_1_crd.stop()

self.is_coordinator(self.svc_dc_2, 0) # self.svc_dc_1_crd_sub is not a coordinator

self.svc_dc_1_crd_sub.stop()
self.svc_dc_2.stop()

@staticmethod
def is_coordinator(svc, node_idx):
node = svc.nodes[node_idx]

assert node.discovery_info().is_coordinator, f"{svc.who_am_i(node)} is not a coordinator"