[GitHub] dspavlov commented on a change in pull request #5662: IGNITE-8227 Research possibility and implement JUnit test failure handler for TeamCity

2019-01-25 Thread GitBox
dspavlov commented on a change in pull request #5662: IGNITE-8227 Research 
possibility and implement JUnit test failure handler for TeamCity
URL: https://github.com/apache/ignite/pull/5662#discussion_r251041326
 
 

 ##
 File path: 
modules/core/src/test/java/org/apache/ignite/failure/TestFailingFailureHandler.java
 ##
 @@ -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.
+ */
+
+package org.apache.ignite.failure;
+
+import junit.framework.TestCase;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.internal.util.tostring.GridToStringExclude;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.testframework.junits.GridAbstractTest;
+
+import static 
org.apache.ignite.testframework.junits.GridAbstractTest.testIsRunning;
+
+/**
+ * Stops node and fails test.
+ */
+public class TestFailingFailureHandler extends StopNodeFailureHandler {
+/** Test. */
+@GridToStringExclude
+protected final GridAbstractTest test;
+
+/**
+ * @param test Test.
+ */
+public TestFailingFailureHandler(GridAbstractTest test) {
+this.test = test;
+}
+
+/** {@inheritDoc} */
+@Override public boolean handle(Ignite ignite, FailureContext failureCtx) {
+if (!testIsRunning.getAndSet(false)) {
 
 Review comment:
   Is it possible that a failure handler will be called by different threads 
with different exceptions? Will these exceptions be visible in a resulting test 
failure?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] dspavlov commented on a change in pull request #5662: IGNITE-8227 Research possibility and implement JUnit test failure handler for TeamCity

2019-01-25 Thread GitBox
dspavlov commented on a change in pull request #5662: IGNITE-8227 Research 
possibility and implement JUnit test failure handler for TeamCity
URL: https://github.com/apache/ignite/pull/5662#discussion_r251034571
 
 

 ##
 File path: 
modules/core/src/test/java/org/apache/ignite/failure/ExpectThrowableFailureHandler.java
 ##
 @@ -0,0 +1,82 @@
+/*
+ * 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.failure;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.internal.util.typedef.X;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.testframework.junits.GridAbstractTest;
+
+/**
+ * Stops node and fails test.
+ */
+public class ExpectThrowableFailureHandler extends TestFailingFailureHandler {
+/** Expected throwables. */
+private final List> errs = new ArrayList<>();
 
 Review comment:
   we can use self-descriptive name expectedErrs instead of errs. It will make 
code more readable


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] dspavlov commented on a change in pull request #5662: IGNITE-8227 Research possibility and implement JUnit test failure handler for TeamCity

2019-01-18 Thread GitBox
dspavlov commented on a change in pull request #5662: IGNITE-8227 Research 
possibility and implement JUnit test failure handler for TeamCity
URL: https://github.com/apache/ignite/pull/5662#discussion_r249099127
 
 

 ##
 File path: 
modules/core/src/test/java/org/apache/ignite/failure/TestFailingFailureHandler.java
 ##
 @@ -0,0 +1,64 @@
+/*
+ * 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.failure;
+
+import junit.framework.TestCase;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.internal.util.tostring.GridToStringExclude;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.testframework.junits.GridAbstractTest;
+
+import static 
org.apache.ignite.testframework.junits.GridAbstractTest.testIsRunning;
+
+/**
+ * Stops node and fails test.
+ */
+public class TestFailingFailureHandler extends StopNodeFailureHandler {
+/** Test. */
+@GridToStringExclude
+protected final GridAbstractTest test;
+
+/**
+ * @param test Test.
+ */
+public TestFailingFailureHandler(GridAbstractTest test) {
+this.test = test;
+}
+
+/** {@inheritDoc} */
+@Override public boolean handle(Ignite ignite, FailureContext failureCtx) {
+if (!testIsRunning.getAndSet(false)) {
+ignite.log().info("Critical issue detected after test finished. 
Test failure handler ignore it.");
+
+return true;
+}
+
+boolean nodeStopped = super.handle(ignite, failureCtx);
+
+TestCase.fail(failureCtx.toString());
 
 Review comment:
   why this line is needed here? This will result in Assertion failed error and 
no handling will be performed later.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services