timoninmaxim commented on a change in pull request #8259: URL: https://github.com/apache/ignite/pull/8259#discussion_r492537882
########## File path: modules/ducktests/tests/ignitetest/tests/assertion_test.py ########## @@ -0,0 +1,73 @@ +# 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 services work +""" + +import datetime + +from ducktape.mark.resource import cluster + +from ignitetest.services.ignite import IgniteService +from ignitetest.services.ignite_app import IgniteApplicationService +from ignitetest.services.utils.ignite_configuration.discovery import from_ignite_cluster +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 SmokeServicesTest(IgniteTest): + """ + Tests services implementations + """ + + @cluster(num_nodes=2) + @ignite_versions(str(DEV_BRANCH)) + def test_ignite_app_start_stop(self, ignite_version): + """ + Test to make sure Java assertions are converted to python exceptions + """ + server_configuration = IgniteConfiguration(version=IgniteVersion(ignite_version)) + + ignite = IgniteService(self.test_context, server_configuration, num_nodes=1) + + client_configuration = server_configuration._replace(client_mode=True, + discovery_spi=from_ignite_cluster(ignite)) + app = IgniteApplicationService( + self.test_context, + client_configuration, + java_class_name="org.apache.ignite.internal.ducktest.tests.smoke_test.AssertionApplication") + + ignite.start() + + ts = int(round(datetime.datetime.now().timestamp() * 1000)) + + try: + app.start() + app.stop() Review comment: You don't need stop there, as exception is thrown due to start(). So move stop() to finally block. ########## File path: modules/ducktests/tests/ignitetest/tests/assertion_test.py ########## @@ -0,0 +1,73 @@ +# 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 services work +""" + +import datetime + +from ducktape.mark.resource import cluster + +from ignitetest.services.ignite import IgniteService +from ignitetest.services.ignite_app import IgniteApplicationService +from ignitetest.services.utils.ignite_configuration.discovery import from_ignite_cluster +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 SmokeServicesTest(IgniteTest): Review comment: Please rename it as test suite with this name already exist. SmokeSelfTest for example. ########## File path: modules/ducktests/tests/ignitetest/tests/assertion_test.py ########## @@ -0,0 +1,73 @@ +# 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 services work +""" + +import datetime + +from ducktape.mark.resource import cluster + +from ignitetest.services.ignite import IgniteService +from ignitetest.services.ignite_app import IgniteApplicationService +from ignitetest.services.utils.ignite_configuration.discovery import from_ignite_cluster +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 SmokeServicesTest(IgniteTest): + """ + Tests services implementations + """ + + @cluster(num_nodes=2) + @ignite_versions(str(DEV_BRANCH)) + def test_ignite_app_start_stop(self, ignite_version): + """ + Test to make sure Java assertions are converted to python exceptions + """ + server_configuration = IgniteConfiguration(version=IgniteVersion(ignite_version)) + + ignite = IgniteService(self.test_context, server_configuration, num_nodes=1) + + client_configuration = server_configuration._replace(client_mode=True, + discovery_spi=from_ignite_cluster(ignite)) + app = IgniteApplicationService( + self.test_context, + client_configuration, + java_class_name="org.apache.ignite.internal.ducktest.tests.smoke_test.AssertionApplication") + + ignite.start() + + ts = int(round(datetime.datetime.now().timestamp() * 1000)) + + try: + app.start() + app.stop() + except Exception as e: + assert str(e) == "Java application execution failed. java.lang.AssertionError" + + """ + Check the test timeout is not exceeded + """ + assert int(round(datetime.datetime.now().timestamp() * 1000)) - ts < IgniteTest.timeout() Review comment: Checking exception string with assertion is enough. Please remove check timestamps. ########## File path: modules/ducktests/tests/ignitetest/tests/assertion_test.py ########## @@ -0,0 +1,73 @@ +# 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 services work +""" + +import datetime + +from ducktape.mark.resource import cluster + +from ignitetest.services.ignite import IgniteService +from ignitetest.services.ignite_app import IgniteApplicationService +from ignitetest.services.utils.ignite_configuration.discovery import from_ignite_cluster +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 SmokeServicesTest(IgniteTest): + """ + Tests services implementations + """ + + @cluster(num_nodes=2) + @ignite_versions(str(DEV_BRANCH)) + def test_ignite_app_start_stop(self, ignite_version): + """ + Test to make sure Java assertions are converted to python exceptions + """ + server_configuration = IgniteConfiguration(version=IgniteVersion(ignite_version)) + + ignite = IgniteService(self.test_context, server_configuration, num_nodes=1) + + client_configuration = server_configuration._replace(client_mode=True, + discovery_spi=from_ignite_cluster(ignite)) + app = IgniteApplicationService( Review comment: You can make it server and avoid using additional node. ########## File path: 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 java.util.UUID; +import org.apache.ignite.IgniteCache; +import org.apache.ignite.internal.IgniteInterruptedCheckedException; +import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication; +import org.apache.ignite.internal.util.typedef.internal.U; + +/** + * Simple application that used in smoke tests + */ +public class AssertionApplication extends IgniteAwareApplication { + /** {@inheritDoc} */ + @Override public void run(JsonNode jsonNode) { + assert false; Review comment: Add markInitialized() after assertion, in case of "-ea" is disabled ducktape hungs while waiting service. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
