timoninmaxim commented on a change in pull request #8362:
URL: https://github.com/apache/ignite/pull/8362#discussion_r506244245



##########
File path: modules/ducktests/tests/ignitetest/services/ignite_app.py
##########
@@ -121,10 +128,10 @@ def extract_results(self, name):
         """
         res = []
 
-        output = self.nodes[0].account.ssh_capture(
-            "grep '%s' %s" % (name + "->", self.STDOUT_STDERR_CAPTURE), 
allow_fail=False)
-
-        for line in output:
-            res.append(re.search("%s(.*)%s" % (name + "->", "<-"), 
line).group(1))
+        for node in self.nodes:
+            output = node.account.ssh_capture(
+                "grep '%s' %s" % (name + "->", self.STDOUT_STDERR_CAPTURE), 
allow_fail=False)
+            for line in output:
+                res.append(re.search("%s(.*)%s" % (name + "->", "<-"), 
line).group(1))

Review comment:
       Imagine you have multiple application nodes, all of them are failed. 
`res` than contains multiple lines. In method above `extract_result` it checks 
size of the error and raises exception.

##########
File path: modules/ducktests/tests/ignitetest/tests/client_in_out_test.py
##########
@@ -0,0 +1,133 @@
+# 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 module contains client tests
+"""
+import time
+from ducktape.mark.resource import cluster
+from ignitetest.services.ignite import IgniteService
+from ignitetest.services.ignite_app import IgniteApplicationService
+from ignitetest.services.utils.control_utility import ControlUtility
+from ignitetest.services.utils.ignite_configuration.cache import 
CacheConfiguration
+from ignitetest.services.utils.ignite_configuration import IgniteConfiguration
+from ignitetest.utils import ignite_versions
+from ignitetest.utils.ignite_test import IgniteTest
+from ignitetest.utils.version import DEV_BRANCH, V_2_8_1, IgniteVersion
+
+
+# pylint: disable=W0223
+class ClientTest(IgniteTest):
+    """
+    CACHE_NAME - name of the cache to create for the test.
+    REPORT_NAME - the name of the tests.
+    PACING - the frequency of the operation on clients (ms).
+    JAVA_CLIENT_CLASS_NAME - running classname.
+    CLIENTS_WORK_TIME_S - clients working time (s).
+    ITERATION_COUNT - the number of iterations of starting and stopping client 
nodes (s).
+    CLUSTER_NODES - cluster size.
+    STATIC_CLIENTS_NUM - the number of permanently employed clients.
+    TEMP_CLIENTS_NUM - number of clients who come log in and out.
+    """
+
+    CACHE_NAME = "simple-tx-cache"
+    PACING = 10

Review comment:
       Why 10?

##########
File path: modules/ducktests/tests/ignitetest/services/ignite_app.py
##########
@@ -53,30 +53,37 @@ def start(self):
 
         self.__check_status("IGNITE_APPLICATION_INITIALIZED", 
timeout=self.timeout_sec)
 
+    # pylint: disable=W0221
+    def stop(self, clean_shutdown=True, timeout_sec=60):
+        self.stop_async(clean_shutdown)

Review comment:
       pydoc is missed

##########
File path: modules/ducktests/tests/ignitetest/services/ignite_app.py
##########
@@ -53,30 +53,37 @@ def start(self):
 
         self.__check_status("IGNITE_APPLICATION_INITIALIZED", 
timeout=self.timeout_sec)
 
+    # pylint: disable=W0221
+    def stop(self, clean_shutdown=True, timeout_sec=60):
+        self.stop_async(clean_shutdown)
+        self.await_stopped(timeout_sec)
+
     def stop_async(self, clean_shutdown=True):
         """
-        Stops node in async way.
+        Stop in async way.
+        """
+        for node in self.nodes:
+            self.stop_node(node=node, clean_shutdown=clean_shutdown)
+
+    def stop_node(self, node, clean_shutdown=True):
+        """
+        Stop node in async way.
         """
-        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, 
str(self.nodes[0].account)))
-        self.nodes[0].account.kill_java_processes(self.servicejava_class_name, 
clean_shutdown=clean_shutdown,
-                                                  allow_fail=True)
+        self.logger.info("%s Stopping node %s" % (self.__class__.__name__, 
str(node.account)))
+        node.account.kill_java_processes(self.servicejava_class_name, 
clean_shutdown=clean_shutdown,
+                                         allow_fail=True)
 
     def await_stopped(self, timeout_sec=10):
         """
         Awaits node stop finish.
         """
-        stopped = self.wait_node(self.nodes[0], timeout_sec=timeout_sec)
-        assert stopped, "Node %s: did not stop within the specified timeout of 
%s seconds" % \
-                        (str(self.nodes[0].account), str(timeout_sec))
+        for node in self.nodes:
+            stopped = self.wait_node(node, timeout_sec=timeout_sec)
+            assert stopped, "Node %s: did not stop within the specified 
timeout of %s seconds" % \
+                            (str(node.account), str(timeout_sec))
 
         self.__check_status("IGNITE_APPLICATION_FINISHED", timeout=timeout_sec)
 
-    # pylint: disable=W0221
-    def stop_node(self, node, clean_shutdown=True, timeout_sec=10):

Review comment:
       As I see you just move this method higher. Let's revert it. 
   Why do you change timeout_sec?

##########
File path: 
modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/start_stop_client/SimpleClient.java
##########
@@ -0,0 +1,63 @@
+/*
+ * 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.
+ */
+
+package org.apache.ignite.internal.ducktest.tests.start_stop_client;
+
+import java.util.Optional;
+import java.util.UUID;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+
+/**
+ * Java client. Tx put operation
+ */
+public class SimpleClient extends IgniteAwareApplication {

Review comment:
       Let's rename simple client to smth more meaningful.

##########
File path: modules/ducktests/tests/ignitetest/tests/client_in_out_test.py
##########
@@ -0,0 +1,133 @@
+# 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 module contains client tests
+"""
+import time
+from ducktape.mark.resource import cluster
+from ignitetest.services.ignite import IgniteService
+from ignitetest.services.ignite_app import IgniteApplicationService
+from ignitetest.services.utils.control_utility import ControlUtility
+from ignitetest.services.utils.ignite_configuration.cache import 
CacheConfiguration
+from ignitetest.services.utils.ignite_configuration import IgniteConfiguration
+from ignitetest.utils import ignite_versions
+from ignitetest.utils.ignite_test import IgniteTest
+from ignitetest.utils.version import DEV_BRANCH, V_2_8_1, IgniteVersion
+
+
+# pylint: disable=W0223
+class ClientTest(IgniteTest):
+    """
+    CACHE_NAME - name of the cache to create for the test.
+    REPORT_NAME - the name of the tests.
+    PACING - the frequency of the operation on clients (ms).
+    JAVA_CLIENT_CLASS_NAME - running classname.
+    CLIENTS_WORK_TIME_S - clients working time (s).
+    ITERATION_COUNT - the number of iterations of starting and stopping client 
nodes (s).
+    CLUSTER_NODES - cluster size.
+    STATIC_CLIENTS_NUM - the number of permanently employed clients.
+    TEMP_CLIENTS_NUM - number of clients who come log in and out.
+    """
+
+    CACHE_NAME = "simple-tx-cache"
+    PACING = 10
+    JAVA_CLIENT_CLASS_NAME = 
"org.apache.ignite.internal.ducktest.tests.start_stop_client.SimpleClient"
+
+    CLIENTS_WORK_TIME_S = 30
+    ITERATION_COUNT = 3
+    CLUSTER_NODES = 7
+    STATIC_CLIENTS_NUM = 2
+    TEMP_CLIENTS_NUM = 3
+
+    @cluster(num_nodes=CLUSTER_NODES)
+    @ignite_versions(str(DEV_BRANCH), str(V_2_8_1))
+    def test_ignite_start_stop(self, ignite_version):
+        """
+        Test for starting and stopping fat clients.
+        """
+
+        servers_count = self.CLUSTER_NODES - self.STATIC_CLIENTS_NUM - 
self.TEMP_CLIENTS_NUM
+
+        # Topology version after test.
+        current_top_v = servers_count
+        fin_top_ver = servers_count + (2 * self.STATIC_CLIENTS_NUM) + (2 * 
self.ITERATION_COUNT * self.TEMP_CLIENTS_NUM)
+
+        server_cfg = IgniteConfiguration(
+            version=IgniteVersion(ignite_version),
+            caches=[CacheConfiguration(name=self.CACHE_NAME, backups=1, 
atomicity_mode='TRANSACTIONAL')]
+        )
+        ignite = IgniteService(self.test_context, server_cfg, 
num_nodes=servers_count)
+        control_utility = ControlUtility(ignite, self.test_context)
+
+        client_cfg = server_cfg._replace(client_mode=True)
+
+        static_clients = IgniteApplicationService(
+            self.test_context,
+            client_cfg,
+            java_class_name=self.JAVA_CLIENT_CLASS_NAME,
+            num_nodes=self.STATIC_CLIENTS_NUM,
+            params={"cacheName": self.CACHE_NAME,
+                    "pacing": self.PACING})
+
+        temp_clients = IgniteApplicationService(
+            self.test_context,
+            client_cfg,
+            java_class_name=self.JAVA_CLIENT_CLASS_NAME,
+            num_nodes=self.TEMP_CLIENTS_NUM,
+            params={"cacheName": self.CACHE_NAME,
+                    "pacing": self.PACING})
+
+        ignite.start()
+
+        static_clients.start()
+
+        current_top_v += self.STATIC_CLIENTS_NUM
+        check_topology(control_utility, current_top_v)
+
+        # Start / stop temp_clients node. Check cluster.
+        for i in range(self.ITERATION_COUNT):
+            self.logger.debug(f'Starting iteration: {i}.')
+
+            time.sleep(self.CLIENTS_WORK_TIME_S)

Review comment:
       Why do you sleep on first iteration?

##########
File path: modules/ducktests/tests/ignitetest/tests/client_in_out_test.py
##########
@@ -0,0 +1,133 @@
+# 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 module contains client tests
+"""
+import time
+from ducktape.mark.resource import cluster
+from ignitetest.services.ignite import IgniteService
+from ignitetest.services.ignite_app import IgniteApplicationService
+from ignitetest.services.utils.control_utility import ControlUtility
+from ignitetest.services.utils.ignite_configuration.cache import 
CacheConfiguration
+from ignitetest.services.utils.ignite_configuration import IgniteConfiguration
+from ignitetest.utils import ignite_versions
+from ignitetest.utils.ignite_test import IgniteTest
+from ignitetest.utils.version import DEV_BRANCH, V_2_8_1, IgniteVersion
+
+
+# pylint: disable=W0223
+class ClientTest(IgniteTest):
+    """
+    CACHE_NAME - name of the cache to create for the test.
+    REPORT_NAME - the name of the tests.
+    PACING - the frequency of the operation on clients (ms).
+    JAVA_CLIENT_CLASS_NAME - running classname.
+    CLIENTS_WORK_TIME_S - clients working time (s).
+    ITERATION_COUNT - the number of iterations of starting and stopping client 
nodes (s).
+    CLUSTER_NODES - cluster size.
+    STATIC_CLIENTS_NUM - the number of permanently employed clients.
+    TEMP_CLIENTS_NUM - number of clients who come log in and out.
+    """
+
+    CACHE_NAME = "simple-tx-cache"
+    PACING = 10
+    JAVA_CLIENT_CLASS_NAME = 
"org.apache.ignite.internal.ducktest.tests.start_stop_client.SimpleClient"
+
+    CLIENTS_WORK_TIME_S = 30

Review comment:
       Why 30?




----------------------------------------------------------------
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]


Reply via email to