You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by is...@apache.org on 2021/02/10 12:39:58 UTC

[ignite-python-thin-client] branch master updated: IGNITE-14154 Remove unnecessary test, remove duplicates

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

isapego pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite-python-thin-client.git


The following commit(s) were added to refs/heads/master by this push:
     new ba268cc   IGNITE-14154 Remove unnecessary test, remove duplicates
ba268cc is described below

commit ba268ccbc747cc667eca2722c646b9395276e738
Author: Ivan Dashchinskiy <iv...@gmail.com>
AuthorDate: Wed Feb 10 15:38:56 2021 +0300

     IGNITE-14154 Remove unnecessary test, remove duplicates
    
     This closes #15
---
 pyignite/queries/response.py           | 23 +++++------------------
 tests/config/ignite-config.xml.jinja2  | 11 -----------
 tests/test_affinity_request_routing.py |  4 ----
 3 files changed, 5 insertions(+), 33 deletions(-)

diff --git a/pyignite/queries/response.py b/pyignite/queries/response.py
index 016f577..ca2ae14 100644
--- a/pyignite/queries/response.py
+++ b/pyignite/queries/response.py
@@ -19,7 +19,6 @@ from collections import OrderedDict
 import ctypes
 
 from pyignite.constants import RHF_TOPOLOGY_CHANGED, RHF_ERROR
-from pyignite.connection import Connection
 from pyignite.datatypes import AnyDataObject, Bool, Int, Long, String, StringArray, Struct
 from pyignite.queries.op_codes import OP_SUCCESS
 from pyignite.stream import READ_BACKWARD
@@ -30,6 +29,7 @@ class Response:
     following = attr.ib(type=list, factory=list)
     protocol_version = attr.ib(type=tuple, factory=tuple)
     _response_header = None
+    _response_class_name = 'Response'
 
     def __attrs_post_init__(self):
         # replace None with empty list
@@ -88,19 +88,16 @@ class Response:
         else:
             self._parse_success(stream, fields)
 
-        response_class = self._create_response_class(stream, header_class, fields)
-        stream.seek(init_pos + ctypes.sizeof(response_class))
-        return self._create_response_class(stream, header_class, fields)
-
-    def _create_response_class(self, stream, header_class, fields: list):
         response_class = type(
-            'Response',
+            self._response_class_name,
             (header_class,),
             {
                 '_pack_': 1,
                 '_fields_': fields,
             }
         )
+
+        stream.seek(init_pos + ctypes.sizeof(response_class))
         return response_class
 
     def _parse_success(self, stream, fields: list):
@@ -130,6 +127,7 @@ class SQLResponse(Response):
     """
     include_field_names = attr.ib(type=bool, default=False)
     has_cursor = attr.ib(type=bool, default=False)
+    _response_class_name = 'SQLResponse'
 
     def fields_or_field_count(self):
         if self.include_field_names:
@@ -182,17 +180,6 @@ class SQLResponse(Response):
             ('more', ctypes.c_byte),
         ]
 
-    def _create_response_class(self, stream, header_class, fields: list):
-        final_class = type(
-            'SQLResponse',
-            (header_class,),
-            {
-                '_pack_': 1,
-                '_fields_': fields,
-            }
-        )
-        return final_class
-
     def to_python(self, ctype_object, *args, **kwargs):
         if getattr(ctype_object, 'status_code', 0) == 0:
             result = {
diff --git a/tests/config/ignite-config.xml.jinja2 b/tests/config/ignite-config.xml.jinja2
index 322a958..834b5d8 100644
--- a/tests/config/ignite-config.xml.jinja2
+++ b/tests/config/ignite-config.xml.jinja2
@@ -81,17 +81,6 @@
             </bean>
         </property>
 
-        <property name="cacheConfiguration">
-            <list>
-                <bean class="org.apache.ignite.configuration.CacheConfiguration">
-                    <property name="name" value="custom-affinity"/>
-                    <property name="affinity">
-                        <bean class="org.apache.ignite.internal.processors.affinity.LocalAffinityFunction"/>
-                    </property>
-                </bean>
-            </list>
-        </property>
-
         <property name="gridLogger">
             <bean class="org.apache.ignite.logger.log4j2.Log4J2Logger">
               <constructor-arg type="java.lang.String" value="config/log4j-{{ ignite_instance_idx }}.xml"/>
diff --git a/tests/test_affinity_request_routing.py b/tests/test_affinity_request_routing.py
index cd0c015..866222b 100644
--- a/tests/test_affinity_request_routing.py
+++ b/tests/test_affinity_request_routing.py
@@ -184,10 +184,6 @@ def test_cache_operation_routed_to_new_cluster_node(request, start_ignite_server
         kill_process_tree(srv.pid)
 
 
-def test_unsupported_affinity_cache_operation_routed_to_random_node(client_partition_aware):
-    verify_random_node(client_partition_aware.get_cache("custom-affinity"))
-
-
 def test_replicated_cache_operation_routed_to_random_node(request, client_partition_aware):
     cache = client_partition_aware.get_or_create_cache({
         PROP_NAME: request.node.name,