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 2021/04/05 14:14:33 UTC

[GitHub] [ignite] anton-vinogradov commented on a change in pull request #8968: IGNITE-13970 Thin client compatibility test

anton-vinogradov commented on a change in pull request #8968:
URL: https://github.com/apache/ignite/pull/8968#discussion_r607092674



##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/thin_client_test/ThinClientSelfTest.java
##########
@@ -0,0 +1,44 @@
+/*
+ * 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.thin_client_test;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.client.ClientCache;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+
+/**
+ * Thin client. Cache test: put, get, remove.
+ */
+public class ThinClientSelfTest extends IgniteAwareApplication {
+    /** {@inheritDoc} */
+    @Override protected void run(JsonNode jsonNode) throws Exception {
+        markInitialized();
+
+        ClientCache<Integer, Integer> cache = client.getOrCreateCache("testCache");
+
+        cache.put(0, 0);
+
+        Integer val = cache.get(0);

Review comment:
       variable newer used.

##########
File path: modules/ducktests/tests/ignitetest/services/ignite_app.py
##########
@@ -46,14 +46,17 @@ def __init__(self, context, config, java_class_name, num_nodes=1, params="", sta
         self.servicejava_class_name = servicejava_class_name
         self.java_class_name = java_class_name
         self.params = params
+        self.start_ignite = start_ignite
 
     def await_started(self):
-        super().await_started()
+        if self.start_ignite:
+            super().await_started()
 
         self.__check_status(self.APP_INIT_EVT_MSG, timeout=self.startup_timeout_sec)
 
     def await_stopped(self):
-        super().await_stopped()
+        if self.start_ignite:

Review comment:
       Incorrect usage.
   We still MUST wait for the Application to finish.

##########
File path: modules/ducktests/tests/ignitetest/services/utils/ignite_configuration/__init__.py
##########
@@ -45,6 +46,7 @@ class IgniteConfiguration(NamedTuple):
     local_host: str = None
     ssl_params: SslParams = None
     connector_configuration: ConnectorConfiguration = None
+    client_connector_configuration: ClientConnectorConfiguration = ClientConnectorConfiguration()

Review comment:
       Should this be enabled by explicit enabling?

##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/utils/IgniteAwareApplicationService.java
##########
@@ -60,6 +61,11 @@ public static void main(String[] args) throws Exception {
 
         app.cfgPath = cfgPath;
 
+        String connStr = jsonNode.get("thin_client_connection").asText();
+
+        if (connStr != null && !connStr.isEmpty())

Review comment:
       We should have a proper switch here.
   `startIgnite` should be replaced with Enum [Node, ThinClient, None]
   The second param in this case should contain configuration for ThinClient if the `ThinClient` case selected.

##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/utils/IgniteAwareApplicationService.java
##########
@@ -60,6 +61,11 @@ public static void main(String[] args) throws Exception {
 
         app.cfgPath = cfgPath;
 
+        String connStr = jsonNode.get("thin_client_connection").asText();

Review comment:
       Should be a constant at least. 
   But, see next comment why this not needed.

##########
File path: modules/ducktests/tests/ignitetest/services/ignite_app.py
##########
@@ -46,14 +46,17 @@ def __init__(self, context, config, java_class_name, num_nodes=1, params="", sta
         self.servicejava_class_name = servicejava_class_name
         self.java_class_name = java_class_name
         self.params = params
+        self.start_ignite = start_ignite

Review comment:
       An incorrect place to store this flag.
   The flag is never used inside the class.
   Should be stored at IgniteAwareService.

##########
File path: modules/ducktests/tests/ignitetest/services/utils/ssl/client_connector_configuration.py
##########
@@ -0,0 +1,30 @@
+# 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 classes and utilities for Ignite ConnectorConfiguration.
+"""
+
+from typing import NamedTuple
+
+from ignitetest.services.utils.ssl.ssl_params import SslParams

Review comment:
       unused

##########
File path: modules/ducktests/tests/ignitetest/tests/thin_client_test.py
##########
@@ -0,0 +1,62 @@
+# 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, matrix
+
+from ignitetest.services.ignite import IgniteService
+from ignitetest.services.ignite_app import IgniteApplicationService
+from ignitetest.services.utils.ignite_configuration import IgniteConfiguration
+from ignitetest.utils import ignite_versions, cluster
+from ignitetest.utils.ignite_test import IgniteTest
+from ignitetest.utils.version import DEV_BRANCH, LATEST, IgniteVersion
+
+class ThinClientTest(IgniteTest):
+    """
+    cluster - cluster size.
+    JAVA_CLIENT_CLASS_NAME - running classname.
+    """
+
+    JAVA_CLIENT_CLASS_NAME = "org.apache.ignite.internal.ducktest.tests.thin_client_test.ThinClientSelfTest"
+
+    @cluster(num_nodes=2)
+    @matrix(server_version=[str(DEV_BRANCH), str(LATEST)], thin_client_version=[str(DEV_BRANCH), str(LATEST)])
+    def test_thin_client_compatibility(self, server_version, thin_client_version):
+        """
+        Thin client compatibility test.
+        """
+
+        server_config = IgniteConfiguration(version=IgniteVersion(server_version))
+
+        ignite = IgniteService(self.test_context, server_config, 1)
+
+        thin_client_connection = ignite.nodes[0].account.hostname + ":" + str(server_config.client_connector_configuration.port)

Review comment:
       Use ThinClient config instead.

##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/thin_client_test/ThinClientSelfTest.java
##########
@@ -0,0 +1,44 @@
+/*
+ * 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.thin_client_test;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.client.ClientCache;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+
+/**
+ * Thin client. Cache test: put, get, remove.
+ */
+public class ThinClientSelfTest extends IgniteAwareApplication {

Review comment:
       Should this be an Application since inherited from the Application?

##########
File path: modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/thin_client_test/ThinClientSelfTest.java
##########
@@ -0,0 +1,44 @@
+/*
+ * 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.thin_client_test;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.client.ClientCache;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+
+/**
+ * Thin client. Cache test: put, get, remove.
+ */
+public class ThinClientSelfTest extends IgniteAwareApplication {
+    /** {@inheritDoc} */
+    @Override protected void run(JsonNode jsonNode) throws Exception {
+        markInitialized();
+
+        ClientCache<Integer, Integer> cache = client.getOrCreateCache("testCache");
+
+        cache.put(0, 0);
+
+        Integer val = cache.get(0);
+
+        cache.remove(0);
+
+        client.destroyCache("testCache");
+
+        markFinished();

Review comment:
       We should have at least one assertion here before finishing, eg. put == read.
   Otherwise, Volkswagen mode is possible.




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