This is an automated email from the ASF dual-hosted git repository.

av pushed a commit to branch ignite-ducktape
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/ignite-ducktape by this push:
     new 3c537ca  Implements @ignite_versions decorator. Add support to 
override parame… (#8213)
3c537ca is described below

commit 3c537ca7447b05a6f0adb29bf2b2eb700b04bd69
Author: Ivan Daschinskiy <ivanda...@gmail.com>
AuthorDate: Fri Sep 4 16:15:13 2020 +0300

    Implements @ignite_versions decorator. Add support to override parame… 
(#8213)
---
 .../tests/ContinuousDataLoadApplication.java       |  4 +-
 modules/ducktests/tests/docker/run_tests.sh        |  5 ++
 .../ignitetest/tests/add_node_rebalance_test.py    | 11 +--
 .../ignitetest/tests/cellular_affinity_test.py     | 16 ++--
 .../tests/ignitetest/tests/control_utility_test.py | 45 +++++-----
 .../tests/ignitetest/tests/discovery_test.py       | 38 +++++----
 .../tests/ignitetest/tests/pme_free_switch_test.py | 13 ++-
 .../ducktests/tests/ignitetest/tests/smoke_test.py | 24 ++++--
 .../ducktests/tests/ignitetest/utils/__init__.py   |  2 +-
 modules/ducktests/tests/ignitetest/utils/_mark.py  | 97 ++++++++++++++++++++--
 10 files changed, 170 insertions(+), 85 deletions(-)

diff --git 
a/modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/ContinuousDataLoadApplication.java
 
b/modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/ContinuousDataLoadApplication.java
index 766ede6..634bdde 100644
--- 
a/modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/ContinuousDataLoadApplication.java
+++ 
b/modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/ContinuousDataLoadApplication.java
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.ducktest.tests;
 import java.util.Collections;
 import java.util.List;
 import java.util.Set;
+import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 import com.fasterxml.jackson.annotation.JsonAutoDetect;
 import com.fasterxml.jackson.annotation.PropertyAccessor;
@@ -29,7 +30,6 @@ import org.apache.ignite.IgniteCache;
 import org.apache.ignite.cache.affinity.Affinity;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
-import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.transactions.Transaction;
 import org.apache.log4j.LogManager;
 import org.apache.log4j.Logger;
@@ -75,7 +75,7 @@ public class ContinuousDataLoadApplication extends 
IgniteAwareApplication {
 
                     ++loaded;
 
-                    if (notifyTime + U.millisToNanos(1500) < System.nanoTime())
+                    if (notifyTime + TimeUnit.MILLISECONDS.toNanos(1500) < 
System.nanoTime())
                         notifyTime = System.nanoTime();
 
                     // Delayed notify of the initialization to make sure the 
data load has completelly began and
diff --git a/modules/ducktests/tests/docker/run_tests.sh 
b/modules/ducktests/tests/docker/run_tests.sh
index b9ee488..d8eb270 100755
--- a/modules/ducktests/tests/docker/run_tests.sh
+++ b/modules/ducktests/tests/docker/run_tests.sh
@@ -76,6 +76,10 @@ The options are as follows:
     - ignite_client_config_path: abs path within container to Ignite client 
config template
     - ignite_server_config_path: abs path within container to Ignite server 
config template
     - jvm_opts: array of JVM options to use when Ignite node started
+    - ignite_version: string representing ignite_versions to test against.
+
+-gj|--global-json)
+    Use specified json as globals to pass to test context. Can be extended 
with -g|--global
 
 -t|--tc-paths
     Path to ducktests. Must be relative path to 
'IGNITE/modules/ducktests/tests' directory
@@ -119,6 +123,7 @@ while [[ $# -ge 1 ]]; do
         -p|--param) duck_add_param "$2"; shift 2;;
         -pj|--params-json) PARAMETERS="$2"; shift 2;;
         -g|--global) duck_add_global "$2"; shift 2;;
+        -gj|--global-json) GLOBALS="$2"; shift 2;;
         -t|--tc-paths) TC_PATHS="$2"; shift 2;;
         -n|--num-nodes) IGNITE_NUM_CONTAINERS="$2"; shift 2;;
         -j|--max-parallel) MAX_PARALLEL="$2"; shift 2;;
diff --git 
a/modules/ducktests/tests/ignitetest/tests/add_node_rebalance_test.py 
b/modules/ducktests/tests/ignitetest/tests/add_node_rebalance_test.py
index b162d2e..0681424 100644
--- a/modules/ducktests/tests/ignitetest/tests/add_node_rebalance_test.py
+++ b/modules/ducktests/tests/ignitetest/tests/add_node_rebalance_test.py
@@ -17,13 +17,13 @@
 Module contains node rebalance tests.
 """
 
-from ducktape.mark import parametrize
 from ducktape.mark.resource import cluster
 
 from ignitetest.services.ignite import IgniteService
 from ignitetest.services.ignite_app import IgniteApplicationService
 from ignitetest.services.utils.ignite_configuration import IgniteConfiguration
 from ignitetest.services.utils.ignite_configuration.discovery import 
from_ignite_cluster
+from ignitetest.utils import ignite_versions
 from ignitetest.utils.ignite_test import IgniteTest
 from ignitetest.utils.version import DEV_BRANCH, IgniteVersion, LATEST
 
@@ -39,20 +39,17 @@ class AddNodeRebalanceTest(IgniteTest):
     REBALANCE_TIMEOUT = 60
 
     @cluster(num_nodes=NUM_NODES + 1)
-    @parametrize(version=str(DEV_BRANCH))
-    @parametrize(version=str(LATEST))
-    def test_add_node(self, version):
+    @ignite_versions(str(DEV_BRANCH), str(LATEST))
+    def test_add_node(self, ignite_version):
         """
         Test performs add node rebalance test which consists of following 
steps:
             * Start cluster.
             * Put data to it via IgniteClientApp.
             * Start one more node and awaits for rebalance to finish.
         """
-        ignite_version = IgniteVersion(version)
-
         self.stage("Start Ignite nodes")
 
-        node_config = IgniteConfiguration(version=ignite_version)
+        node_config = 
IgniteConfiguration(version=IgniteVersion(ignite_version))
 
         ignites = IgniteService(self.test_context, config=node_config, 
num_nodes=self.NUM_NODES - 1)
         ignites.start()
diff --git a/modules/ducktests/tests/ignitetest/tests/cellular_affinity_test.py 
b/modules/ducktests/tests/ignitetest/tests/cellular_affinity_test.py
index 6b1e664..c957e43 100644
--- a/modules/ducktests/tests/ignitetest/tests/cellular_affinity_test.py
+++ b/modules/ducktests/tests/ignitetest/tests/cellular_affinity_test.py
@@ -17,7 +17,6 @@
 This module contains Cellular Affinity tests.
 """
 
-from ducktape.mark import parametrize
 from ducktape.mark.resource import cluster
 from jinja2 import Template
 
@@ -25,6 +24,7 @@ from ignitetest.services.ignite import IgniteService
 from ignitetest.services.ignite_app import IgniteApplicationService
 from ignitetest.services.utils.ignite_configuration import 
IgniteConfiguration, IgniteClientConfiguration
 from ignitetest.services.utils.ignite_configuration.discovery import 
from_ignite_cluster
+from ignitetest.utils import ignite_versions, version_if
 from ignitetest.utils.ignite_test import IgniteTest
 from ignitetest.utils.version import DEV_BRANCH, IgniteVersion
 
@@ -71,18 +71,20 @@ class CellularAffinity(IgniteTest):
                     cacheName=CellularAffinity.CACHE_NAME)
 
     @cluster(num_nodes=NUM_NODES * 3 + 1)
-    @parametrize(version=str(DEV_BRANCH))
-    def test(self, version):
+    @version_if(lambda version: version >= DEV_BRANCH)
+    @ignite_versions(str(DEV_BRANCH))
+    def test(self, ignite_version):
         """
         Test Cellular Affinity scenario (partition distribution).
         """
-        cell1 = self.start_cell(version, ['-D' + CellularAffinity.ATTRIBUTE + 
'=1'])
-        self.start_cell(version, ['-D' + CellularAffinity.ATTRIBUTE + '=2'], 
joined_cluster=cell1)
-        self.start_cell(version, ['-D' + CellularAffinity.ATTRIBUTE + '=XXX', 
'-DRANDOM=42'], joined_cluster=cell1)
+        cell1 = self.start_cell(ignite_version, ['-D' + 
CellularAffinity.ATTRIBUTE + '=1'])
+        self.start_cell(ignite_version, ['-D' + CellularAffinity.ATTRIBUTE + 
'=2'], joined_cluster=cell1)
+        self.start_cell(ignite_version, ['-D' + CellularAffinity.ATTRIBUTE + 
'=XXX', '-DRANDOM=42'],
+                        joined_cluster=cell1)
 
         checker = IgniteApplicationService(
             self.test_context,
-            IgniteClientConfiguration(version=IgniteVersion(version), 
discovery_spi=from_ignite_cluster(cell1)),
+            IgniteClientConfiguration(version=IgniteVersion(ignite_version), 
discovery_spi=from_ignite_cluster(cell1)),
             
java_class_name="org.apache.ignite.internal.ducktest.tests.cellular_affinity_test.DistributionChecker",
             params={"cacheName": CellularAffinity.CACHE_NAME,
                     "attr": CellularAffinity.ATTRIBUTE,
diff --git a/modules/ducktests/tests/ignitetest/tests/control_utility_test.py 
b/modules/ducktests/tests/ignitetest/tests/control_utility_test.py
index a4afd09..a30a381 100644
--- a/modules/ducktests/tests/ignitetest/tests/control_utility_test.py
+++ b/modules/ducktests/tests/ignitetest/tests/control_utility_test.py
@@ -16,7 +16,7 @@
 """
 This module contains control.sh utility tests.
 """
-from ducktape.mark import parametrize
+
 from ducktape.mark.resource import cluster
 from ducktape.utils.util import wait_until
 
@@ -25,7 +25,7 @@ from ignitetest.services.utils.control_utility import 
ControlUtility, ControlUti
 from ignitetest.services.utils.ignite_configuration import 
IgniteConfiguration, DataStorageConfiguration
 from ignitetest.services.utils.ignite_configuration.data_storage import 
DataRegionConfiguration
 from ignitetest.services.utils.ignite_configuration.discovery import 
from_ignite_cluster
-from ignitetest.utils import version_if
+from ignitetest.utils import version_if, ignite_versions
 from ignitetest.utils.ignite_test import IgniteTest
 from ignitetest.utils.version import DEV_BRANCH, LATEST_2_8, IgniteVersion, 
LATEST_2_7, V_2_8_0
 
@@ -38,15 +38,13 @@ class BaselineTests(IgniteTest):
     NUM_NODES = 3
 
     @cluster(num_nodes=NUM_NODES)
-    @parametrize(version=str(DEV_BRANCH))
-    @parametrize(version=str(LATEST_2_8))
-    @parametrize(version=str(LATEST_2_7))
-    def test_baseline_set(self, version):
+    @ignite_versions(str(DEV_BRANCH), str(LATEST_2_8), str(LATEST_2_7))
+    def test_baseline_set(self, ignite_version):
         """
         Test baseline set.
         """
         blt_size = self.NUM_NODES - 2
-        servers = self.__start_ignite_nodes(version, blt_size)
+        servers = self.__start_ignite_nodes(ignite_version, blt_size)
 
         control_utility = ControlUtility(servers, self.test_context)
         control_utility.activate()
@@ -57,7 +55,7 @@ class BaselineTests(IgniteTest):
         self.__check_nodes_in_baseline(servers.nodes, baseline)
 
         # Set baseline using list of consisttent ids.
-        new_node = self.__start_ignite_nodes(version, 1, join_cluster=servers)
+        new_node = self.__start_ignite_nodes(ignite_version, 1, 
join_cluster=servers)
         control_utility.set_baseline(servers.nodes + new_node.nodes)
         blt_size += 1
 
@@ -66,7 +64,7 @@ class BaselineTests(IgniteTest):
         self.__check_nodes_in_baseline(new_node.nodes, baseline)
 
         # Set baseline using topology version.
-        new_node = self.__start_ignite_nodes(version, 1, join_cluster=servers)
+        new_node = self.__start_ignite_nodes(ignite_version, 1, 
join_cluster=servers)
         _, version, _ = control_utility.cluster_state()
         control_utility.set_baseline(version)
         blt_size += 1
@@ -76,22 +74,20 @@ class BaselineTests(IgniteTest):
         self.__check_nodes_in_baseline(new_node.nodes, baseline)
 
     @cluster(num_nodes=NUM_NODES)
-    @parametrize(version=str(DEV_BRANCH))
-    @parametrize(version=str(LATEST_2_8))
-    @parametrize(version=str(LATEST_2_7))
-    def test_baseline_add_remove(self, version):
+    @ignite_versions(str(DEV_BRANCH), str(LATEST_2_8), str(LATEST_2_7))
+    def test_baseline_add_remove(self, ignite_version):
         """
         Test add and remove nodes from baseline.
         """
         blt_size = self.NUM_NODES - 1
-        servers = self.__start_ignite_nodes(version, blt_size)
+        servers = self.__start_ignite_nodes(ignite_version, blt_size)
 
         control_utility = ControlUtility(servers, self.test_context)
 
         control_utility.activate()
 
         # Add node to baseline.
-        new_node = self.__start_ignite_nodes(version, 1, join_cluster=servers)
+        new_node = self.__start_ignite_nodes(ignite_version, 1, 
join_cluster=servers)
         control_utility.add_to_baseline(new_node.nodes)
         blt_size += 1
 
@@ -120,14 +116,12 @@ class BaselineTests(IgniteTest):
         self.__check_nodes_not_in_baseline(new_node.nodes, baseline)
 
     @cluster(num_nodes=NUM_NODES)
-    @parametrize(version=str(DEV_BRANCH))
-    @parametrize(version=str(LATEST_2_8))
-    @parametrize(version=str(LATEST_2_7))
-    def test_activate_deactivate(self, version):
+    @ignite_versions(str(DEV_BRANCH), str(LATEST_2_8), str(LATEST_2_7))
+    def test_activate_deactivate(self, ignite_version):
         """
         Test activate and deactivate cluster.
         """
-        servers = self.__start_ignite_nodes(version, self.NUM_NODES)
+        servers = self.__start_ignite_nodes(ignite_version, self.NUM_NODES)
 
         control_utility = ControlUtility(servers, self.test_context)
 
@@ -145,21 +139,20 @@ class BaselineTests(IgniteTest):
 
     @cluster(num_nodes=NUM_NODES)
     @version_if(lambda version: version >= V_2_8_0)
-    @parametrize(version=str(DEV_BRANCH))
-    @parametrize(version=str(LATEST_2_8))
-    def test_baseline_autoadjust(self, version):
+    @ignite_versions(str(DEV_BRANCH), str(LATEST_2_8), str(LATEST_2_7))
+    def test_baseline_autoadjust(self, ignite_version):
         """
         Test activate and deactivate cluster.
         """
         blt_size = self.NUM_NODES - 2
-        servers = self.__start_ignite_nodes(version, blt_size)
+        servers = self.__start_ignite_nodes(ignite_version, blt_size)
 
         control_utility = ControlUtility(servers, self.test_context)
         control_utility.activate()
 
         # Add node.
         control_utility.enable_baseline_auto_adjust(2000)
-        new_node = self.__start_ignite_nodes(version, 1, join_cluster=servers)
+        new_node = self.__start_ignite_nodes(ignite_version, 1, 
join_cluster=servers)
         blt_size += 1
 
         wait_until(lambda: len(control_utility.baseline()) == blt_size, 
timeout_sec=5)
@@ -170,7 +163,7 @@ class BaselineTests(IgniteTest):
         # Add node when auto adjust disabled.
         control_utility.disable_baseline_auto_adjust()
         old_topology = control_utility.cluster_state().topology_version
-        new_node = self.__start_ignite_nodes(version, 1, join_cluster=servers)
+        new_node = self.__start_ignite_nodes(ignite_version, 1, 
join_cluster=servers)
 
         wait_until(lambda: control_utility.cluster_state().topology_version != 
old_topology, timeout_sec=5)
         baseline = control_utility.baseline()
diff --git a/modules/ducktests/tests/ignitetest/tests/discovery_test.py 
b/modules/ducktests/tests/ignitetest/tests/discovery_test.py
index 9b28e97..8d806a4 100644
--- a/modules/ducktests/tests/ignitetest/tests/discovery_test.py
+++ b/modules/ducktests/tests/ignitetest/tests/discovery_test.py
@@ -36,17 +36,18 @@ from 
ignitetest.services.utils.ignite_configuration.discovery import from_zookee
     TcpDiscoverySpi
 from ignitetest.services.utils.time_utils import epoch_mills
 from ignitetest.services.zk.zookeeper import ZookeeperService
+from ignitetest.utils import ignite_versions, version_if
 from ignitetest.utils.ignite_test import IgniteTest
-from ignitetest.utils.version import DEV_BRANCH, LATEST_2_8, IgniteVersion
+from ignitetest.utils.version import DEV_BRANCH, LATEST_2_8, V_2_8_0, 
IgniteVersion
 
 
 class ClusterLoad(IntEnum):
     """
     Type of cluster loading.
     """
-    none = 0
-    atomic = 1
-    transactional = 2
+    NONE = 0
+    ATOMIC = 1
+    TRANSACTIONAL = 2
 
 
 class DiscoveryTestConfig(NamedTuple):
@@ -56,7 +57,7 @@ class DiscoveryTestConfig(NamedTuple):
     version: IgniteVersion
     nodes_to_kill: int = 1
     kill_coordinator: bool = False
-    load_type: ClusterLoad = ClusterLoad.none
+    load_type: ClusterLoad = ClusterLoad.NONE
     with_zk: bool = False
 
 
@@ -77,31 +78,32 @@ class DiscoveryTest(IgniteTest):
     WARMUP_DATA_AMOUNT = 10_000
 
     @cluster(num_nodes=NUM_NODES)
-    @matrix(version=[str(DEV_BRANCH), str(LATEST_2_8)],
-            kill_coordinator=[False, True],
+    @ignite_versions(str(DEV_BRANCH), str(LATEST_2_8))
+    @matrix(kill_coordinator=[False, True],
             nodes_to_kill=[1, 2],
-            load_type=[ClusterLoad.none, ClusterLoad.atomic, 
ClusterLoad.transactional])
-    def test_node_fail_tcp(self, version, kill_coordinator, nodes_to_kill, 
load_type):
+            load_type=[ClusterLoad.NONE, ClusterLoad.ATOMIC, 
ClusterLoad.TRANSACTIONAL])
+    def test_node_fail_tcp(self, ignite_version, kill_coordinator, 
nodes_to_kill, load_type):
         """
         Test nodes failure scenario with TcpDiscoverySpi.
         :param load_type: How to load cluster during the test: 0 - no loading; 
1 - do some loading; 2 - transactional.
         """
-        test_config = DiscoveryTestConfig(version=IgniteVersion(version), 
kill_coordinator=kill_coordinator,
+        test_config = 
DiscoveryTestConfig(version=IgniteVersion(ignite_version), 
kill_coordinator=kill_coordinator,
                                           nodes_to_kill=nodes_to_kill, 
load_type=load_type, with_zk=False)
 
         return self._perform_node_fail_scenario(test_config)
 
     @cluster(num_nodes=NUM_NODES + 3)
-    @matrix(version=[str(DEV_BRANCH), str(LATEST_2_8)],
-            kill_coordinator=[False, True],
+    @version_if(lambda version: version != V_2_8_0)  # ignite-zookeeper 
package is broken in 2.8.0
+    @ignite_versions(str(DEV_BRANCH), str(LATEST_2_8))
+    @matrix(kill_coordinator=[False, True],
             nodes_to_kill=[1, 2],
-            load_type=[ClusterLoad.none, ClusterLoad.atomic, 
ClusterLoad.transactional])
-    def test_node_fail_zk(self, version, kill_coordinator, nodes_to_kill, 
load_type):
+            load_type=[ClusterLoad.NONE, ClusterLoad.ATOMIC, 
ClusterLoad.TRANSACTIONAL])
+    def test_node_fail_zk(self, ignite_version, kill_coordinator, 
nodes_to_kill, load_type):
         """
         Test node failure scenario with ZooKeeperSpi.
         :param load_type: How to load cluster during the test: 0 - no loading; 
1 - do some loading; 2 - transactional.
         """
-        test_config = DiscoveryTestConfig(version=IgniteVersion(version), 
kill_coordinator=kill_coordinator,
+        test_config = 
DiscoveryTestConfig(version=IgniteVersion(ignite_version), 
kill_coordinator=kill_coordinator,
                                           nodes_to_kill=nodes_to_kill, 
load_type=load_type, with_zk=True)
 
         return self._perform_node_fail_scenario(test_config)
@@ -121,7 +123,7 @@ class DiscoveryTest(IgniteTest):
             discovery_spi=discovery_spi,
             failure_detection_timeout=self.FAILURE_DETECTION_TIMEOUT,
             caches=[CacheConfiguration(name='test-cache', backups=1, 
atomicity_mode='TRANSACTIONAL' if
-            test_config.load_type == ClusterLoad.transactional else 'ATOMIC')]
+            test_config.load_type == ClusterLoad.TRANSACTIONAL else 'ATOMIC')]
         )
 
         servers, start_servers_sec = start_servers(self.test_context, 
self.NUM_NODES - 1, ignite_config, modules)
@@ -129,12 +131,12 @@ class DiscoveryTest(IgniteTest):
         failed_nodes, survived_node = choose_node_to_kill(servers, 
test_config.kill_coordinator,
                                                           
test_config.nodes_to_kill)
 
-        if test_config.load_type is not ClusterLoad.none:
+        if test_config.load_type is not ClusterLoad.NONE:
             load_config = ignite_config._replace(client_mode=True) if 
test_config.with_zk else \
                 ignite_config._replace(client_mode=True, 
discovery_spi=from_ignite_cluster(servers))
 
             tran_nodes = [n.discovery_info().node_id for n in failed_nodes] \
-                if test_config.load_type == ClusterLoad.transactional else None
+                if test_config.load_type == ClusterLoad.TRANSACTIONAL else None
 
             params = {"cacheName": "test-cache",
                       "range": self.DATA_AMOUNT,
diff --git a/modules/ducktests/tests/ignitetest/tests/pme_free_switch_test.py 
b/modules/ducktests/tests/ignitetest/tests/pme_free_switch_test.py
index 8ec2daa..395b24b 100644
--- a/modules/ducktests/tests/ignitetest/tests/pme_free_switch_test.py
+++ b/modules/ducktests/tests/ignitetest/tests/pme_free_switch_test.py
@@ -19,7 +19,6 @@ This module contains PME free switch tests.
 
 import time
 
-from ducktape.mark import parametrize
 from ducktape.mark.resource import cluster
 
 from ignitetest.services.ignite import IgniteService
@@ -28,6 +27,7 @@ from ignitetest.services.utils.control_utility import 
ControlUtility
 from ignitetest.services.utils.ignite_configuration import IgniteConfiguration
 from ignitetest.services.utils.ignite_configuration.cache import 
CacheConfiguration
 from ignitetest.services.utils.ignite_configuration.discovery import 
from_ignite_cluster
+from ignitetest.utils import ignite_versions
 from ignitetest.utils.ignite_test import IgniteTest
 from ignitetest.utils.version import DEV_BRANCH, LATEST_2_7, V_2_8_0, 
IgniteVersion
 
@@ -40,9 +40,8 @@ class PmeFreeSwitchTest(IgniteTest):
     NUM_NODES = 3
 
     @cluster(num_nodes=NUM_NODES + 2)
-    @parametrize(version=str(DEV_BRANCH))
-    @parametrize(version=str(LATEST_2_7))
-    def test(self, version):
+    @ignite_versions(str(DEV_BRANCH), str(LATEST_2_7))
+    def test(self, ignite_version):
         """
         Test PME free scenario (node stop).
         """
@@ -50,10 +49,8 @@ class PmeFreeSwitchTest(IgniteTest):
 
         self.stage("Starting nodes")
 
-        ignite_version = IgniteVersion(version)
-
         config = IgniteConfiguration(
-            version=ignite_version,
+            version=IgniteVersion(ignite_version),
             caches=[CacheConfiguration(name='test-cache', backups=2, 
atomicity_mode='TRANSACTIONAL')]
         )
 
@@ -85,7 +82,7 @@ class PmeFreeSwitchTest(IgniteTest):
 
         single_key_tx_streamer.start()
 
-        if ignite_version >= V_2_8_0:
+        if IgniteVersion(ignite_version) >= V_2_8_0:
             ControlUtility(ignites, 
self.test_context).disable_baseline_auto_adjust()
 
         self.stage("Stopping server node")
diff --git a/modules/ducktests/tests/ignitetest/tests/smoke_test.py 
b/modules/ducktests/tests/ignitetest/tests/smoke_test.py
index d7207a2..f58d3c5 100644
--- a/modules/ducktests/tests/ignitetest/tests/smoke_test.py
+++ b/modules/ducktests/tests/ignitetest/tests/smoke_test.py
@@ -17,15 +17,15 @@
 This module contains smoke tests that checks that services work
 """
 
-from ducktape.mark import parametrize
 from ducktape.mark.resource import cluster
 
 from ignitetest.services.ignite import IgniteService
 from ignitetest.services.ignite_app import IgniteApplicationService
 from ignitetest.services.spark import SparkService
 from ignitetest.services.utils.ignite_configuration.discovery import 
from_ignite_cluster
-from ignitetest.services.utils.ignite_configuration import 
IgniteConfiguration, IgniteClientConfiguration
+from ignitetest.services.utils.ignite_configuration import IgniteConfiguration
 from ignitetest.services.zk.zookeeper import ZookeeperService
+from ignitetest.utils import ignite_versions
 from ignitetest.utils.ignite_test import IgniteTest
 from ignitetest.utils.version import DEV_BRANCH, IgniteVersion
 
@@ -37,26 +37,32 @@ class SmokeServicesTest(IgniteTest):
     """
 
     @cluster(num_nodes=1)
-    @parametrize(version=str(DEV_BRANCH))
-    def test_ignite_start_stop(self, version):
+    @ignite_versions(str(DEV_BRANCH))
+    def test_ignite_start_stop(self, ignite_version):
         """
         Test that IgniteService correctly start and stop
         """
-        ignite = IgniteService(self.test_context, 
IgniteConfiguration(version=IgniteVersion(version)), num_nodes=1)
+        ignite = IgniteService(self.test_context, 
IgniteConfiguration(version=IgniteVersion(ignite_version)),
+                               num_nodes=1)
+        print(self.test_context)
         ignite.start()
         ignite.stop()
 
     @cluster(num_nodes=2)
-    @parametrize(version=str(DEV_BRANCH))
-    def test_ignite_app_start_stop(self, version):
+    @ignite_versions(str(DEV_BRANCH))
+    def test_ignite_app_start_stop(self, ignite_version):
         """
         Test that IgniteService and IgniteApplicationService correctly start 
and stop
         """
-        ignite = IgniteService(self.test_context, 
IgniteConfiguration(version=IgniteVersion(version)), num_nodes=1)
+        server_configuration = 
IgniteConfiguration(version=IgniteVersion(ignite_version))
 
+        ignite = IgniteService(self.test_context, server_configuration, 
num_nodes=1)
+
+        client_configuration = server_configuration._replace(client_mode=True,
+                                                             
discovery_spi=from_ignite_cluster(ignite))
         app = IgniteApplicationService(
             self.test_context,
-            IgniteClientConfiguration(version=IgniteVersion(version), 
discovery_spi=from_ignite_cluster(ignite)),
+            client_configuration,
             
java_class_name="org.apache.ignite.internal.ducktest.tests.smoke_test.SimpleApplication")
 
         ignite.start()
diff --git a/modules/ducktests/tests/ignitetest/utils/__init__.py 
b/modules/ducktests/tests/ignitetest/utils/__init__.py
index 777351b..838c333 100644
--- a/modules/ducktests/tests/ignitetest/utils/__init__.py
+++ b/modules/ducktests/tests/ignitetest/utils/__init__.py
@@ -14,4 +14,4 @@
 # limitations under the License.
 
 # pylint: disable=C0114
-from ._mark import version_if
+from ._mark import version_if, ignite_versions
diff --git a/modules/ducktests/tests/ignitetest/utils/_mark.py 
b/modules/ducktests/tests/ignitetest/utils/_mark.py
index 7387d50..99f328f 100644
--- a/modules/ducktests/tests/ignitetest/utils/_mark.py
+++ b/modules/ducktests/tests/ignitetest/utils/_mark.py
@@ -16,7 +16,10 @@
 """
 Module contains useful test decorators.
 """
-from ducktape.mark._mark import Ignore, Mark
+
+from collections.abc import Iterable
+
+from ducktape.mark._mark import Ignore, Mark, _inject
 
 from ignitetest.utils.version import IgniteVersion
 
@@ -25,17 +28,18 @@ class VersionIf(Ignore):
     """
     Ignore test if version doesn't corresponds to condition.
     """
-    def __init__(self, condition):
+    def __init__(self, condition, variable_name):
         super().__init__()
         self.condition = condition
+        self.variable_name = variable_name
 
     def apply(self, seed_context, context_list):
         assert len(context_list) > 0, "ignore_if decorator is not being 
applied to any test cases"
 
         for ctx in context_list:
-            assert 'version' in ctx.injected_args, "'version' in injected args 
not present"
-            version = ctx.injected_args['version']
-            assert isinstance(version, str), "'version' in injected args must 
be a string"
+            assert self.variable_name in ctx.injected_args, "'%s' in injected 
args not present" % (self.variable_name,)
+            version = ctx.injected_args[self.variable_name]
+            assert isinstance(version, str), "'%s'n injected args must be a 
string" % (self.variable_name,)
             ctx.ignore = ctx.ignore or not 
self.condition(IgniteVersion(version))
 
         return context_list
@@ -44,14 +48,93 @@ class VersionIf(Ignore):
         return super().__eq__(other) and self.condition == other.condition
 
 
-def version_if(condition):
+class IgniteVersionParametrize(Mark):
+    """
+    Parametrize function with ignite_version
+    """
+    def __init__(self, *args, version_prefix):
+        """
+        :param args: Can be string, tuple of strings or iterable of them.
+        :param version_prefix: prefix for variable to inject into test 
function.
+        """
+        self.versions = list(args)
+        self.version_prefix = version_prefix
+
+    def apply(self, seed_context, context_list):
+        if 'ignite_versions' in seed_context.globals:
+            ver = seed_context.globals['ignite_versions']
+            if isinstance(ver, str):
+                self.versions = [ver]
+            elif isinstance(ver, Iterable):
+                self.versions = list(ver)
+            else:
+                raise AssertionError("Expected string or iterable as parameter 
in ignite_versions, "
+                                     "%s of type %s passed" % (ver, type(ver)))
+
+        new_context_list = []
+        if context_list:
+            for ctx in context_list:
+                for version in self.versions:
+                    if ctx.injected_args and 'ignite_version' in 
ctx.injected_args:
+                        continue
+
+                    new_context_list.insert(0, self._prepare_new_ctx(version, 
seed_context, ctx))
+        else:
+            for version in self.versions:
+                new_context_list.insert(0, self._prepare_new_ctx(version, 
seed_context))
+
+        return new_context_list
+
+    def _prepare_new_ctx(self, version, seed_context, ctx=None):
+        injected_args = dict(ctx.injected_args) if ctx and ctx.injected_args 
else {}
+
+        if isinstance(version, (list, tuple)) and len(version) >= 2:
+            for idx, ver in enumerate(version):
+                injected_args["%s_%s" % (self.version_prefix, idx + 1)] = ver
+        elif isinstance(version, str):
+            injected_args[self.version_prefix] = version
+        else:
+            raise AssertionError("Expected string or iterable of size greater 
than 2 as element in ignite_versions,"
+                                 "%s of type %s passed" % (version, 
type(version)))
+
+        injected_fun = _inject(**injected_args)(seed_context.function)
+
+        return seed_context.copy(function=injected_fun, 
injected_args=injected_args)
+
+    @property
+    def name(self):
+        """
+        This function should return "PARAMETRIZE" string in order to 
ducktape's method parametrization works.
+        Should be fixed after apropriate patch in ducktape will be merged.
+        """
+        return "PARAMETRIZE"
+
+    def __eq__(self, other):
+        return super().__eq__(other) and self.versions == other.versions
+
+
+def ignite_versions(*args, version_prefix="ignite_version"):
+    """
+    Decorate test function to inject ignite versions. Versions will be 
overriden by globals "ignite_versions" param.
+    :param args: Can be string, tuple of strings or iterable of them.
+    :param version_prefix: prefix for variable to inject into test function.
+    """
+    def parametrizer(func):
+        Mark.mark(func, IgniteVersionParametrize(*args, 
version_prefix=version_prefix))
+
+        return func
+    return parametrizer
+
+
+def version_if(condition, variable_name='ignite_version'):
     """
     Mark decorated test method as IGNORE if version doesn't corresponds to 
condition.
 
     :param condition: function(IgniteVersion) -> bool
+    :param variable_name: version variable name
     """
     def ignorer(func):
-        Mark.mark(func, VersionIf(condition))
+        Mark.mark(func, VersionIf(condition, variable_name))
         return func
 
     return ignorer

Reply via email to