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

[ignite] branch master updated: IGNITE-14152 Fixed jcache-tck profile exclude tests mask (#8787)

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

mmuzaf pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
     new abd7778  IGNITE-14152 Fixed jcache-tck profile exclude tests mask (#8787)
abd7778 is described below

commit abd7778d20893b9b8cac3e5b6d819fe47bb33644
Author: Maksim Timonin <ti...@gmail.com>
AuthorDate: Fri Feb 12 20:36:42 2021 +0300

    IGNITE-14152 Fixed jcache-tck profile exclude tests mask (#8787)
---
 modules/core/pom.xml                                |  4 +++-
 .../surefire/testsuites/AssertOnOrphanedTests.java  |  2 ++
 .../surefire/testsuites/CheckAllTestsInSuites.java  |  2 +-
 .../surefire/testsuites/OrphanedTestCollection.java | 21 +++++++++++++++++++--
 pom.xml                                             |  3 ---
 5 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/modules/core/pom.xml b/modules/core/pom.xml
index d107c0f..3a16475 100644
--- a/modules/core/pom.xml
+++ b/modules/core/pom.xml
@@ -492,7 +492,9 @@
                                 <IGNITE_QUIET>false</IGNITE_QUIET>
                             </systemPropertyVariables>
                             <excludes>
-                                <exclude>**/org/apache/ignite/**/*Test.java</exclude>
+                                <!-- Parent's pom.xml includes all Ignite test classes (tests, suites) in the surefire plugin.
+                                     So need to exclude all of them to test only JCache tests. -->
+                                <exclude>**/org/apache/ignite/**/*.java</exclude>
                                 <exclude>**/annotation/*Test.java</exclude>
                                 <exclude>**/ClientServerTest.java</exclude>
                             </excludes>
diff --git a/modules/tools/src/main/java/org/apache/ignite/tools/surefire/testsuites/AssertOnOrphanedTests.java b/modules/tools/src/main/java/org/apache/ignite/tools/surefire/testsuites/AssertOnOrphanedTests.java
index d5a59b0..90ada11 100644
--- a/modules/tools/src/main/java/org/apache/ignite/tools/surefire/testsuites/AssertOnOrphanedTests.java
+++ b/modules/tools/src/main/java/org/apache/ignite/tools/surefire/testsuites/AssertOnOrphanedTests.java
@@ -34,6 +34,8 @@ public class AssertOnOrphanedTests {
             return;
         }
 
+        orphanedTestCollection.persistOrphanedTests(orphanedTests, true);
+
         StringBuilder builder = new StringBuilder("All test classes must be include in any test suite")
             .append(" or mark with the @Ignore annotation.")
             .append("\nList of non-suited classes (")
diff --git a/modules/tools/src/main/java/org/apache/ignite/tools/surefire/testsuites/CheckAllTestsInSuites.java b/modules/tools/src/main/java/org/apache/ignite/tools/surefire/testsuites/CheckAllTestsInSuites.java
index d105ad1..c4c36b7 100644
--- a/modules/tools/src/main/java/org/apache/ignite/tools/surefire/testsuites/CheckAllTestsInSuites.java
+++ b/modules/tools/src/main/java/org/apache/ignite/tools/surefire/testsuites/CheckAllTestsInSuites.java
@@ -85,7 +85,7 @@ public class CheckAllTestsInSuites {
 
             orphanedTests.addAll(allTestClasses);
 
-            orphaned.persistOrphanedTests(orphanedTests);
+            orphaned.persistOrphanedTests(orphanedTests, false);
 
         } catch (Exception e) {
             throw new RuntimeException("Failed to check orphaned tests.", e);
diff --git a/modules/tools/src/main/java/org/apache/ignite/tools/surefire/testsuites/OrphanedTestCollection.java b/modules/tools/src/main/java/org/apache/ignite/tools/surefire/testsuites/OrphanedTestCollection.java
index 4249bc4..3796117 100644
--- a/modules/tools/src/main/java/org/apache/ignite/tools/surefire/testsuites/OrphanedTestCollection.java
+++ b/modules/tools/src/main/java/org/apache/ignite/tools/surefire/testsuites/OrphanedTestCollection.java
@@ -33,6 +33,12 @@ import java.util.Set;
  * Represents a persisted list of orphaned tests.
  */
 public class OrphanedTestCollection {
+    /**
+     * This line in the file shows that the list of orphaned tests is final for all maven modules.
+     * {@link #getOrphanedTests()} ignores a content of the file if read this mark.
+     * */
+    private static final String FINAL_MARK = "---";
+
     /** File to persist orphaned tests. */
     private final Path path = initPath();
 
@@ -46,6 +52,9 @@ public class OrphanedTestCollection {
         ) {
             String testClsName = testReader.readLine();
 
+            if (FINAL_MARK.equals(testClsName))
+                return new HashSet<>();
+
             Set<String> testClasses = new HashSet<>();
 
             while (testClsName != null) {
@@ -58,11 +67,19 @@ public class OrphanedTestCollection {
         }
     }
 
-    /** */
-    public void persistOrphanedTests(Collection<String> testClasses) throws Exception {
+    /**
+     * @param testClasses Collection of test classes names.
+     * @param last Whether it's the last call within whole project.
+     */
+    public void persistOrphanedTests(Collection<String> testClasses, boolean last) throws Exception {
         try (
             BufferedWriter testWriter = new BufferedWriter(new FileWriter(path.toFile()))
         ) {
+            if (last) {
+                testWriter.write(FINAL_MARK);
+                testWriter.newLine();
+            }
+
             for (String cls: testClasses) {
                 testWriter.write(cls);
                 testWriter.newLine();
diff --git a/pom.xml b/pom.xml
index 43c63639d8..a054b86 100644
--- a/pom.xml
+++ b/pom.xml
@@ -821,9 +821,6 @@
                         <configuration>
                             <includePluginDependencies>true</includePluginDependencies>
                             <mainClass>org.apache.ignite.tools.surefire.testsuites.AssertOnOrphanedTests</mainClass>
-                            <arguments>
-                                <argument>${project.modules}</argument>
-                            </arguments>
                         </configuration>
                     </plugin>
                 </plugins>