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

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


The following commit(s) were added to refs/heads/ignite-ducktape by this push:
     new cb0b247  IGNITE-13434 add assertion test (#8259)
cb0b247 is described below

commit cb0b2475249c419bc720ca1d7c4b0c2b06565965
Author: oleg-ostanin <48506823+oleg-osta...@users.noreply.github.com>
AuthorDate: Thu Sep 24 11:20:44 2020 +0300

    IGNITE-13434 add assertion test (#8259)
---
 .../tests/smoke_test/AssertionApplication.java     | 35 ++++++++++++++
 .../tests/ignitetest/services/ignite_app.py        |  3 +-
 .../services/ignite_execution_exception.py         | 24 ++++++++++
 .../tests/ignitetest/tests/assertion_test.py       | 55 ++++++++++++++++++++++
 4 files changed, 116 insertions(+), 1 deletion(-)

diff --git 
a/modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/smoke_test/AssertionApplication.java
 
b/modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/smoke_test/AssertionApplication.java
new file mode 100644
index 0000000..0cb0d20
--- /dev/null
+++ 
b/modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/smoke_test/AssertionApplication.java
@@ -0,0 +1,35 @@
+/*
+ * 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.smoke_test;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
+
+/**
+ * Application to check java assertions to python exception conversion
+ */
+public class AssertionApplication extends IgniteAwareApplication {
+    /** {@inheritDoc} */
+    @Override public void run(JsonNode jsonNode) {
+        assert false;
+
+        markInitialized();
+
+        markFinished();
+    }
+}
diff --git a/modules/ducktests/tests/ignitetest/services/ignite_app.py 
b/modules/ducktests/tests/ignitetest/services/ignite_app.py
index 74b7fba..8fbf035 100644
--- a/modules/ducktests/tests/ignitetest/services/ignite_app.py
+++ b/modules/ducktests/tests/ignitetest/services/ignite_app.py
@@ -22,6 +22,7 @@ import re
 # pylint: disable=W0622
 from ducktape.errors import TimeoutError
 
+from ignitetest.services.ignite_execution_exception import 
IgniteExecutionException
 from ignitetest.services.utils.ignite_aware import IgniteAwareService
 
 
@@ -81,7 +82,7 @@ class IgniteApplicationService(IgniteAwareService):
 
         try:
             self.await_event("IGNITE_APPLICATION_BROKEN", 1, 
from_the_beginning=True)
-            raise Exception("Java application execution failed. %s" % 
self.extract_result("ERROR"))
+            raise IgniteExecutionException("Java application execution failed. 
%s" % self.extract_result("ERROR"))
         except TimeoutError:
             pass
 
diff --git 
a/modules/ducktests/tests/ignitetest/services/ignite_execution_exception.py 
b/modules/ducktests/tests/ignitetest/services/ignite_execution_exception.py
new file mode 100644
index 0000000..ce6cb56
--- /dev/null
+++ b/modules/ducktests/tests/ignitetest/services/ignite_execution_exception.py
@@ -0,0 +1,24 @@
+# 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.
+
+"""
+Ignite execution exception
+"""
+
+
+class IgniteExecutionException(Exception):
+    """
+    Ignite execution exception implementation
+    """
diff --git a/modules/ducktests/tests/ignitetest/tests/assertion_test.py 
b/modules/ducktests/tests/ignitetest/tests/assertion_test.py
new file mode 100644
index 0000000..5ab9c90
--- /dev/null
+++ b/modules/ducktests/tests/ignitetest/tests/assertion_test.py
@@ -0,0 +1,55 @@
+# 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 smoke tests that checks that ducktape works as expected
+"""
+
+from ducktape.mark.resource import cluster
+
+from ignitetest.services.ignite_app import IgniteApplicationService
+from ignitetest.services.ignite_execution_exception import 
IgniteExecutionException
+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, IgniteVersion
+
+
+# pylint: disable=W0223
+class SmokeSelfTest(IgniteTest):
+    """
+    Self test
+    """
+
+    @cluster(num_nodes=1)
+    @ignite_versions(str(DEV_BRANCH))
+    def test_assertion_convertion(self, ignite_version):
+        """
+        Test to make sure Java assertions are converted to python exceptions
+        """
+        server_configuration = 
IgniteConfiguration(version=IgniteVersion(ignite_version))
+
+        app = IgniteApplicationService(
+            self.test_context,
+            server_configuration,
+            
java_class_name="org.apache.ignite.internal.ducktest.tests.smoke_test.AssertionApplication")
+
+        try:
+            app.start()
+        except IgniteExecutionException as ex:
+            assert str(ex) == "Java application execution failed. 
java.lang.AssertionError"
+        else:
+            app.stop()
+            assert False

Reply via email to