You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by mp...@apache.org on 2022/10/28 05:35:53 UTC

[ignite] branch master updated: IGNITE-17937 Fixed initialization of test home path for non Ignite projects (#10334)

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

mpetrov 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 e4ee77287eb IGNITE-17937 Fixed initialization of test home path  for non Ignite projects (#10334)
e4ee77287eb is described below

commit e4ee77287eba9242947d6520dd40024fab1012c4
Author: Mikhail Petrov <32...@users.noreply.github.com>
AuthorDate: Fri Oct 28 08:35:47 2022 +0300

    IGNITE-17937 Fixed initialization of test home path  for non Ignite projects (#10334)
---
 .../test/java/org/apache/ignite/testframework/GridTestUtils.java  | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java b/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
index a609ddea11d..cc3e282bf72 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
@@ -106,7 +106,6 @@ import org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDataba
 import org.apache.ignite.internal.processors.odbc.ClientListenerProcessor;
 import org.apache.ignite.internal.processors.port.GridPortRecord;
 import org.apache.ignite.internal.util.GridBusyLock;
-import org.apache.ignite.internal.util.IgniteUtils;
 import org.apache.ignite.internal.util.future.GridFutureAdapter;
 import org.apache.ignite.internal.util.lang.GridAbsClosure;
 import org.apache.ignite.internal.util.lang.GridAbsPredicate;
@@ -1298,9 +1297,14 @@ public final class GridTestUtils {
         String igniteHome = U.getIgniteHome();
 
         if (F.isEmpty(igniteHome)) {
+            // We failed to automatically resolve IGNITE_HOME. This can happen if Ignite Test Framework is used as a
+            // library in some external project. Let's forcibly set IGNITE_HOME to the user's working directory.
+            // Setting the IGNITE_HOME system property is crucial because Ignite Test Logging system relies on it
+            // to resolve log file paths.
             igniteHome = new File(System.getProperty("user.dir"), "ignite").getAbsolutePath();
 
-            IgniteUtils.setIgniteHome(igniteHome);
+            U.nullifyHomeDirectory();
+            U.setIgniteHome(igniteHome);
 
             U.warn(null, '"' + IGNITE_HOME + "\" system property was automatically set to " + igniteHome);
         }