You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2020/10/14 20:46:33 UTC

[GitHub] [ignite] SwirMix opened a new pull request #8362: Ignite 13489 client in out test

SwirMix opened a new pull request #8362:
URL: https://github.com/apache/ignite/pull/8362


   client start and stop in loop
   
   Thank you for submitting the pull request to the Apache Ignite.
   
   In order to streamline the review of the contribution 
   we ask you to ensure the following steps have been taken:
   
   ### The Contribution Checklist
   - [ ] There is a single JIRA ticket related to the pull request. 
   - [ ] The web-link to the pull request is attached to the JIRA ticket.
   - [ ] The JIRA ticket has the _Patch Available_ state.
   - [ ] The pull request body describes changes that have been made. 
   The description explains _WHAT_ and _WHY_ was made instead of _HOW_.
   - [ ] The pull request title is treated as the final commit message. 
   The following pattern must be used: `IGNITE-XXXX Change summary` where `XXXX` - number of JIRA issue.
   - [ ] A reviewer has been mentioned through the JIRA comments 
   (see [the Maintainers list](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute#HowtoContribute-ReviewProcessandMaintainers)) 
   - [ ] The pull request has been checked by the Teamcity Bot and 
   the `green visa` attached to the JIRA ticket (see [TC.Bot: Check PR](https://mtcga.gridgain.com/prs.html))
   
   ### Notes
   - [How to Contribute](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute)
   - [Coding abbreviation rules](https://cwiki.apache.org/confluence/display/IGNITE/Abbreviation+Rules)
   - [Coding Guidelines](https://cwiki.apache.org/confluence/display/IGNITE/Coding+Guidelines)
   - [Apache Ignite Teamcity Bot](https://cwiki.apache.org/confluence/display/IGNITE/Apache+Ignite+Teamcity+Bot)
   
   If you need any help, please email dev@ignite.apache.org or ask anу advice on http://asf.slack.com _#ignite_ channel.
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [ignite] timoninmaxim commented on a change in pull request #8362: Ignite 13489 client in out test

Posted by GitBox <gi...@apache.org>.
timoninmaxim commented on a change in pull request #8362:
URL: https://github.com/apache/ignite/pull/8362#discussion_r509107406



##########
File path: modules/ducktests/tests/ignitetest/tests/client_in_out_test.py
##########
@@ -0,0 +1,173 @@
+# 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 import parametrize
+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):
+    """
+    cluster - cluster size
+    CACHE_NAME - name of the cache to create for the test.
+    PACING - the frequency of the operation on clients (ms).
+    JAVA_CLIENT_CLASS_NAME - running classname.
+    client_work_time - clients working time (s).
+    iteration_count - the number of iterations of starting and stopping client nodes (s).
+    static_clients - the number of permanently employed clients.
+    temp_client - 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.IgniteCachePutClient"
+
+    @ignite_versions(str(V_2_8_1), str(DEV_BRANCH))
+    @parametrize(cluster=7,
+                 static_clients=2,
+                 temp_client=3,
+                 iteration_count=3,
+                 client_work_time=30)
+    # pylint: disable=R0913
+    def test_ignite_start_stop_nodes(self, ignite_version,
+                                     cluster, static_clients, temp_client, iteration_count, client_work_time):
+        """
+        Start and stop clients node test without kill java process.
+        Check topology.
+        """
+        self.ignite_start_stop(ignite_version, False, cluster, static_clients,
+                               temp_client, iteration_count, client_work_time)
+
+    @ignite_versions(str(V_2_8_1), str(DEV_BRANCH))
+    @parametrize(cluster=7,
+                 static_clients=2,
+                 temp_client=3,
+                 iteration_count=3,
+                 client_work_time=30)
+    # pylint: disable=R0913
+    def test_ignite_kill_start_nodes(self, ignite_version,
+                                     cluster, static_clients, temp_client, iteration_count, client_work_time):
+        """
+        Start and kill client nodes, Check topology
+        """
+        self.ignite_start_stop(ignite_version, True, cluster, static_clients,
+                               temp_client, iteration_count, client_work_time)
+
+    # pylint: disable=R0914
+    # pylint: disable=R0913
+    def ignite_start_stop(self, ignite_version, kill_temp_nodes,
+                          cluster, static_clients_num, temp_client, iteration_count, client_work_time):
+        """
+        Test for starting and stopping fat clients.
+        """
+
+        servers_count = cluster - static_clients_num - temp_client
+
+        current_top_v = servers_count
+        # Topology version after test.
+        fin_top_ver = servers_count + (2 * static_clients_num) + (2 * iteration_count * temp_client)
+
+        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=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=temp_client,
+            params={"cacheName": self.CACHE_NAME,
+                    "pacing": self.PACING})
+
+        ignite.start()
+
+        static_clients.start()
+
+        current_top_v += static_clients_num
+        check_topology(control_utility, current_top_v)
+
+        # Start / stop temp_clients node. Check cluster.
+        for i in range(iteration_count):
+            self.logger.debug(f'Starting iteration: {i}.')
+
+            temp_clients.start()
+            current_top_v += temp_client
+
+            static_clients.await_event(f'ver={current_top_v}, locNode=', timeout_sec=80,
+                                       from_the_beginning=True, backoff_sec=1)
+            check_topology(control_utility, current_top_v)
+
+            temp_clients.await_event(f'clients={static_clients_num + temp_client}',
+                                     timeout_sec=80,
+                                     from_the_beginning=True,
+                                     backoff_sec=1)
+
+            time.sleep(client_work_time)
+            stop_service_nodes(temp_clients, kill_temp_nodes)
+
+            current_top_v += temp_client
+
+        static_clients.await_event(f'ver={current_top_v}, locNode=', timeout_sec=80,
+                                   from_the_beginning=True, backoff_sec=0.1)
+        static_clients.stop()
+
+        check_topology(control_utility, fin_top_ver)
+
+
+def stop_service_nodes(service: IgniteApplicationService, kill_nodes):
+    """
+    Base service stop command.
+    If kill_nodes=True kill node.
+    If kill_nodes=False then the node is shutting down correctly
+    """
+    if kill_nodes:
+        for node in service.nodes:
+            service.stop_node(node=node, clean_shutdown=False)
+    else:
+        service.stop(clean_shutdown=True)

Review comment:
       Why do not replace this if-else block with `service.stop(clean_shutdown=kill_nodes)`?




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [ignite] SwirMix commented on a change in pull request #8362: Ignite 13489 client in out test

Posted by GitBox <gi...@apache.org>.
SwirMix commented on a change in pull request #8362:
URL: https://github.com/apache/ignite/pull/8362#discussion_r509277454



##########
File path: modules/ducktests/tests/ignitetest/services/ignite_app.py
##########
@@ -110,7 +121,8 @@ def extract_result(self, name):
         """
         results = self.extract_results(name)
 
-        assert len(results) <= 1, f"Expected exactly one result occurence, {len(results)} found."
+        assert len(results) <= len(self.nodes), f"Expected exactly {len(self.nodes)} occurence," \

Review comment:
       only here it is necessary ==




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [ignite] timoninmaxim commented on pull request #8362: Ignite 13489 client in out test

Posted by GitBox <gi...@apache.org>.
timoninmaxim commented on pull request #8362:
URL: https://github.com/apache/ignite/pull/8362#issuecomment-715029565


   LGTM


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [ignite] SwirMix commented on a change in pull request #8362: Ignite 13489 client in out test

Posted by GitBox <gi...@apache.org>.
SwirMix commented on a change in pull request #8362:
URL: https://github.com/apache/ignite/pull/8362#discussion_r509198942



##########
File path: modules/ducktests/tests/ignitetest/tests/client_in_out_test.py
##########
@@ -0,0 +1,173 @@
+# 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 import parametrize
+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):
+    """
+    cluster - cluster size
+    CACHE_NAME - name of the cache to create for the test.
+    PACING - the frequency of the operation on clients (ms).
+    JAVA_CLIENT_CLASS_NAME - running classname.
+    client_work_time - clients working time (s).
+    iteration_count - the number of iterations of starting and stopping client nodes (s).
+    static_clients - the number of permanently employed clients.
+    temp_client - 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.IgniteCachePutClient"
+
+    @ignite_versions(str(V_2_8_1), str(DEV_BRANCH))
+    @parametrize(cluster=7,
+                 static_clients=2,
+                 temp_client=3,
+                 iteration_count=3,
+                 client_work_time=30)
+    # pylint: disable=R0913
+    def test_ignite_start_stop_nodes(self, ignite_version,

Review comment:
       ok. I found your ticket thank you!




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [ignite] timoninmaxim commented on a change in pull request #8362: Ignite 13489 client in out test

Posted by GitBox <gi...@apache.org>.
timoninmaxim commented on a change in pull request #8362:
URL: https://github.com/apache/ignite/pull/8362#discussion_r509119930



##########
File path: modules/ducktests/tests/ignitetest/tests/client_in_out_test.py
##########
@@ -0,0 +1,173 @@
+# 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 import parametrize
+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):
+    """
+    cluster - cluster size
+    CACHE_NAME - name of the cache to create for the test.
+    PACING - the frequency of the operation on clients (ms).
+    JAVA_CLIENT_CLASS_NAME - running classname.
+    client_work_time - clients working time (s).
+    iteration_count - the number of iterations of starting and stopping client nodes (s).
+    static_clients - the number of permanently employed clients.
+    temp_client - 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.IgniteCachePutClient"
+
+    @ignite_versions(str(V_2_8_1), str(DEV_BRANCH))
+    @parametrize(cluster=7,
+                 static_clients=2,
+                 temp_client=3,
+                 iteration_count=3,
+                 client_work_time=30)
+    # pylint: disable=R0913
+    def test_ignite_start_stop_nodes(self, ignite_version,
+                                     cluster, static_clients, temp_client, iteration_count, client_work_time):
+        """
+        Start and stop clients node test without kill java process.
+        Check topology.
+        """
+        self.ignite_start_stop(ignite_version, False, cluster, static_clients,
+                               temp_client, iteration_count, client_work_time)
+
+    @ignite_versions(str(V_2_8_1), str(DEV_BRANCH))
+    @parametrize(cluster=7,
+                 static_clients=2,
+                 temp_client=3,
+                 iteration_count=3,
+                 client_work_time=30)
+    # pylint: disable=R0913
+    def test_ignite_kill_start_nodes(self, ignite_version,
+                                     cluster, static_clients, temp_client, iteration_count, client_work_time):
+        """
+        Start and kill client nodes, Check topology
+        """
+        self.ignite_start_stop(ignite_version, True, cluster, static_clients,
+                               temp_client, iteration_count, client_work_time)
+
+    # pylint: disable=R0914
+    # pylint: disable=R0913
+    def ignite_start_stop(self, ignite_version, kill_temp_nodes,
+                          cluster, static_clients_num, temp_client, iteration_count, client_work_time):
+        """
+        Test for starting and stopping fat clients.
+        """
+
+        servers_count = cluster - static_clients_num - temp_client
+
+        current_top_v = servers_count
+        # Topology version after test.
+        fin_top_ver = servers_count + (2 * static_clients_num) + (2 * iteration_count * temp_client)
+
+        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=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=temp_client,
+            params={"cacheName": self.CACHE_NAME,
+                    "pacing": self.PACING})
+
+        ignite.start()
+
+        static_clients.start()
+
+        current_top_v += static_clients_num
+        check_topology(control_utility, current_top_v)
+
+        # Start / stop temp_clients node. Check cluster.
+        for i in range(iteration_count):
+            self.logger.debug(f'Starting iteration: {i}.')
+
+            temp_clients.start()
+            current_top_v += temp_client
+
+            static_clients.await_event(f'ver={current_top_v}, locNode=', timeout_sec=80,
+                                       from_the_beginning=True, backoff_sec=1)
+            check_topology(control_utility, current_top_v)
+
+            temp_clients.await_event(f'clients={static_clients_num + temp_client}',
+                                     timeout_sec=80,
+                                     from_the_beginning=True,
+                                     backoff_sec=1)
+
+            time.sleep(client_work_time)
+            stop_service_nodes(temp_clients, kill_temp_nodes)
+
+            current_top_v += temp_client
+
+        static_clients.await_event(f'ver={current_top_v}, locNode=', timeout_sec=80,
+                                   from_the_beginning=True, backoff_sec=0.1)
+        static_clients.stop()
+
+        check_topology(control_utility, fin_top_ver)
+
+
+def stop_service_nodes(service: IgniteApplicationService, kill_nodes):
+    """
+    Base service stop command.
+    If kill_nodes=True kill node.
+    If kill_nodes=False then the node is shutting down correctly
+    """
+    if kill_nodes:
+        for node in service.nodes:
+            service.stop_node(node=node, clean_shutdown=False)
+    else:
+        service.stop(clean_shutdown=True)

Review comment:
       It's because service.stop waits for completion message "IGNITE_APPLICATION_FINISHED" in any case. So if clean_shutdown is False there is no reason to wait the message. So. It's a bug of `stop` method. Let's fix it instead




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [ignite] timoninmaxim commented on a change in pull request #8362: Ignite 13489 client in out test

Posted by GitBox <gi...@apache.org>.
timoninmaxim commented on a change in pull request #8362:
URL: https://github.com/apache/ignite/pull/8362#discussion_r509137411



##########
File path: modules/ducktests/tests/ignitetest/tests/client_in_out_test.py
##########
@@ -0,0 +1,173 @@
+# 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 import parametrize
+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):
+    """
+    cluster - cluster size
+    CACHE_NAME - name of the cache to create for the test.
+    PACING - the frequency of the operation on clients (ms).
+    JAVA_CLIENT_CLASS_NAME - running classname.
+    client_work_time - clients working time (s).
+    iteration_count - the number of iterations of starting and stopping client nodes (s).
+    static_clients - the number of permanently employed clients.
+    temp_client - 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.IgniteCachePutClient"
+
+    @ignite_versions(str(V_2_8_1), str(DEV_BRANCH))
+    @parametrize(cluster=7,
+                 static_clients=2,
+                 temp_client=3,
+                 iteration_count=3,
+                 client_work_time=30)
+    # pylint: disable=R0913
+    def test_ignite_start_stop_nodes(self, ignite_version,

Review comment:
       To enable run the test in parallel with others please use @cluster decorator. If user wants to run experiments with different number of nodes, the one must comment the decorator in feature branch.
   
   Actually we need a flag for ducktape to ignore this decorator if needed. I will make a ticket for that.




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [ignite] timoninmaxim commented on a change in pull request #8362: Ignite 13489 client in out test

Posted by GitBox <gi...@apache.org>.
timoninmaxim commented on a change in pull request #8362:
URL: https://github.com/apache/ignite/pull/8362#discussion_r509129664



##########
File path: modules/ducktests/tests/ignitetest/services/ignite_app.py
##########
@@ -110,7 +121,8 @@ def extract_result(self, name):
         """
         results = self.extract_results(name)
 
-        assert len(results) <= 1, f"Expected exactly one result occurence, {len(results)} found."
+        assert len(results) <= len(self.nodes), f"Expected exactly {len(self.nodes)} occurence," \

Review comment:
       let's replace <= with !=. 




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [ignite] SwirMix commented on a change in pull request #8362: Ignite 13489 client in out test

Posted by GitBox <gi...@apache.org>.
SwirMix commented on a change in pull request #8362:
URL: https://github.com/apache/ignite/pull/8362#discussion_r509121670



##########
File path: modules/ducktests/tests/ignitetest/tests/client_in_out_test.py
##########
@@ -0,0 +1,173 @@
+# 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 import parametrize
+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):
+    """
+    cluster - cluster size
+    CACHE_NAME - name of the cache to create for the test.
+    PACING - the frequency of the operation on clients (ms).
+    JAVA_CLIENT_CLASS_NAME - running classname.
+    client_work_time - clients working time (s).
+    iteration_count - the number of iterations of starting and stopping client nodes (s).
+    static_clients - the number of permanently employed clients.
+    temp_client - 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.IgniteCachePutClient"
+
+    @ignite_versions(str(V_2_8_1), str(DEV_BRANCH))
+    @parametrize(cluster=7,
+                 static_clients=2,
+                 temp_client=3,
+                 iteration_count=3,
+                 client_work_time=30)
+    # pylint: disable=R0913
+    def test_ignite_start_stop_nodes(self, ignite_version,
+                                     cluster, static_clients, temp_client, iteration_count, client_work_time):
+        """
+        Start and stop clients node test without kill java process.
+        Check topology.
+        """
+        self.ignite_start_stop(ignite_version, False, cluster, static_clients,
+                               temp_client, iteration_count, client_work_time)
+
+    @ignite_versions(str(V_2_8_1), str(DEV_BRANCH))
+    @parametrize(cluster=7,
+                 static_clients=2,
+                 temp_client=3,
+                 iteration_count=3,
+                 client_work_time=30)
+    # pylint: disable=R0913
+    def test_ignite_kill_start_nodes(self, ignite_version,
+                                     cluster, static_clients, temp_client, iteration_count, client_work_time):
+        """
+        Start and kill client nodes, Check topology
+        """
+        self.ignite_start_stop(ignite_version, True, cluster, static_clients,
+                               temp_client, iteration_count, client_work_time)
+
+    # pylint: disable=R0914
+    # pylint: disable=R0913
+    def ignite_start_stop(self, ignite_version, kill_temp_nodes,
+                          cluster, static_clients_num, temp_client, iteration_count, client_work_time):
+        """
+        Test for starting and stopping fat clients.
+        """
+
+        servers_count = cluster - static_clients_num - temp_client
+
+        current_top_v = servers_count
+        # Topology version after test.
+        fin_top_ver = servers_count + (2 * static_clients_num) + (2 * iteration_count * temp_client)
+
+        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=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=temp_client,
+            params={"cacheName": self.CACHE_NAME,
+                    "pacing": self.PACING})
+
+        ignite.start()
+
+        static_clients.start()
+
+        current_top_v += static_clients_num
+        check_topology(control_utility, current_top_v)
+
+        # Start / stop temp_clients node. Check cluster.
+        for i in range(iteration_count):
+            self.logger.debug(f'Starting iteration: {i}.')
+
+            temp_clients.start()
+            current_top_v += temp_client
+
+            static_clients.await_event(f'ver={current_top_v}, locNode=', timeout_sec=80,
+                                       from_the_beginning=True, backoff_sec=1)
+            check_topology(control_utility, current_top_v)
+
+            temp_clients.await_event(f'clients={static_clients_num + temp_client}',
+                                     timeout_sec=80,
+                                     from_the_beginning=True,
+                                     backoff_sec=1)
+
+            time.sleep(client_work_time)
+            stop_service_nodes(temp_clients, kill_temp_nodes)
+
+            current_top_v += temp_client
+
+        static_clients.await_event(f'ver={current_top_v}, locNode=', timeout_sec=80,
+                                   from_the_beginning=True, backoff_sec=0.1)
+        static_clients.stop()
+
+        check_topology(control_utility, fin_top_ver)
+
+
+def stop_service_nodes(service: IgniteApplicationService, kill_nodes):
+    """
+    Base service stop command.
+    If kill_nodes=True kill node.
+    If kill_nodes=False then the node is shutting down correctly
+    """
+    if kill_nodes:
+        for node in service.nodes:
+            service.stop_node(node=node, clean_shutdown=False)
+    else:
+        service.stop(clean_shutdown=True)

Review comment:
       I guessed, but I was even more afraid to rule. Okay, I'll fix it.




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [ignite] SwirMix commented on a change in pull request #8362: Ignite 13489 client in out test

Posted by GitBox <gi...@apache.org>.
SwirMix commented on a change in pull request #8362:
URL: https://github.com/apache/ignite/pull/8362#discussion_r509187959



##########
File path: modules/ducktests/tests/ignitetest/services/ignite_app.py
##########
@@ -110,7 +121,8 @@ def extract_result(self, name):
         """
         results = self.extract_results(name)
 
-        assert len(results) <= 1, f"Expected exactly one result occurence, {len(results)} found."
+        assert len(results) <= len(self.nodes), f"Expected exactly {len(self.nodes)} occurence," \

Review comment:
       ok




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [ignite] SwirMix commented on a change in pull request #8362: Ignite 13489 client in out test

Posted by GitBox <gi...@apache.org>.
SwirMix commented on a change in pull request #8362:
URL: https://github.com/apache/ignite/pull/8362#discussion_r509112197



##########
File path: modules/ducktests/tests/ignitetest/tests/client_in_out_test.py
##########
@@ -0,0 +1,173 @@
+# 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 import parametrize
+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):
+    """
+    cluster - cluster size
+    CACHE_NAME - name of the cache to create for the test.
+    PACING - the frequency of the operation on clients (ms).
+    JAVA_CLIENT_CLASS_NAME - running classname.
+    client_work_time - clients working time (s).
+    iteration_count - the number of iterations of starting and stopping client nodes (s).
+    static_clients - the number of permanently employed clients.
+    temp_client - 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.IgniteCachePutClient"
+
+    @ignite_versions(str(V_2_8_1), str(DEV_BRANCH))
+    @parametrize(cluster=7,
+                 static_clients=2,
+                 temp_client=3,
+                 iteration_count=3,
+                 client_work_time=30)
+    # pylint: disable=R0913
+    def test_ignite_start_stop_nodes(self, ignite_version,
+                                     cluster, static_clients, temp_client, iteration_count, client_work_time):
+        """
+        Start and stop clients node test without kill java process.
+        Check topology.
+        """
+        self.ignite_start_stop(ignite_version, False, cluster, static_clients,
+                               temp_client, iteration_count, client_work_time)
+
+    @ignite_versions(str(V_2_8_1), str(DEV_BRANCH))
+    @parametrize(cluster=7,
+                 static_clients=2,
+                 temp_client=3,
+                 iteration_count=3,
+                 client_work_time=30)
+    # pylint: disable=R0913
+    def test_ignite_kill_start_nodes(self, ignite_version,
+                                     cluster, static_clients, temp_client, iteration_count, client_work_time):
+        """
+        Start and kill client nodes, Check topology
+        """
+        self.ignite_start_stop(ignite_version, True, cluster, static_clients,
+                               temp_client, iteration_count, client_work_time)
+
+    # pylint: disable=R0914
+    # pylint: disable=R0913
+    def ignite_start_stop(self, ignite_version, kill_temp_nodes,
+                          cluster, static_clients_num, temp_client, iteration_count, client_work_time):
+        """
+        Test for starting and stopping fat clients.
+        """
+
+        servers_count = cluster - static_clients_num - temp_client
+
+        current_top_v = servers_count
+        # Topology version after test.
+        fin_top_ver = servers_count + (2 * static_clients_num) + (2 * iteration_count * temp_client)
+
+        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=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=temp_client,
+            params={"cacheName": self.CACHE_NAME,
+                    "pacing": self.PACING})
+
+        ignite.start()
+
+        static_clients.start()
+
+        current_top_v += static_clients_num
+        check_topology(control_utility, current_top_v)
+
+        # Start / stop temp_clients node. Check cluster.
+        for i in range(iteration_count):
+            self.logger.debug(f'Starting iteration: {i}.')
+
+            temp_clients.start()
+            current_top_v += temp_client
+
+            static_clients.await_event(f'ver={current_top_v}, locNode=', timeout_sec=80,
+                                       from_the_beginning=True, backoff_sec=1)
+            check_topology(control_utility, current_top_v)
+
+            temp_clients.await_event(f'clients={static_clients_num + temp_client}',
+                                     timeout_sec=80,
+                                     from_the_beginning=True,
+                                     backoff_sec=1)
+
+            time.sleep(client_work_time)
+            stop_service_nodes(temp_clients, kill_temp_nodes)
+
+            current_top_v += temp_client
+
+        static_clients.await_event(f'ver={current_top_v}, locNode=', timeout_sec=80,
+                                   from_the_beginning=True, backoff_sec=0.1)
+        static_clients.stop()
+
+        check_topology(control_utility, fin_top_ver)
+
+
+def stop_service_nodes(service: IgniteApplicationService, kill_nodes):
+    """
+    Base service stop command.
+    If kill_nodes=True kill node.
+    If kill_nodes=False then the node is shutting down correctly
+    """
+    if kill_nodes:
+        for node in service.nodes:
+            service.stop_node(node=node, clean_shutdown=False)
+    else:
+        service.stop(clean_shutdown=True)

Review comment:
       the base timeout of 10 seconds was not enough to register completion in the base method. However, when they are completed sequentially, I fit into the timeout




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [ignite] timoninmaxim commented on a change in pull request #8362: Ignite 13489 client in out test

Posted by GitBox <gi...@apache.org>.
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:
users@infra.apache.org



[GitHub] [ignite] SwirMix commented on a change in pull request #8362: Ignite 13489 client in out test

Posted by GitBox <gi...@apache.org>.
SwirMix commented on a change in pull request #8362:
URL: https://github.com/apache/ignite/pull/8362#discussion_r506308298



##########
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:
       Okay, I'll return it

##########
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:
       OK, what about IgniteCachePutClient?

##########
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:
       revert changes

##########
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:
       We give the STATIC_CLIENTS_NUM client group time to WORK during the CLIENTS_WORK_TIME_S time for each iteration of the TEMP_CLIENTS_NUM client group entry and exit. This is done in order to get a stable state of the cluster under a stable load after each client login and exit procedure

##########
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:
       Pacing is an internal delay, the interval between discrete operations. This is a customized parameter, 10 ms is selected so that we know for sure that the average number of operations generated by the client does not exceed 100 operations per second

##########
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:
       Yes, I see. Then it is better to build a check based on a dynamic parameter. I mean, instead of the expected 1 line, expect len(self.nodes). Am I getting this right?

##########
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:
       CLIENTS_WORK_TIME_S - the working time of the client group. It is selected in such a way as to allow time for the load level to stabilize. A certain number of clients are included in the topology and work in this number of CLIENTS_WORK_TIME_S of time. From my point of view, this operating time is not too high, but it is sufficient for the load level on the cluster to settle after new fat clients enter the cluster. But I admit that I'm wrong.




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [ignite] nizhikov merged pull request #8362: IGNITE-13489 Clients log in and out of the topology

Posted by GitBox <gi...@apache.org>.
nizhikov merged pull request #8362:
URL: https://github.com/apache/ignite/pull/8362


   


----------------------------------------------------------------
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:
users@infra.apache.org