1717
1818package org .apache .ignite .util ;
1919
20+ import java .io .IOException ;
21+ import java .nio .file .Files ;
22+ import java .nio .file .Path ;
23+ import java .nio .file .Paths ;
24+ import java .nio .file .StandardCopyOption ;
25+ import jdk .jfr .Recording ;
2026import org .apache .ignite .internal .management .rollingupgrade .RollingUpgradeCommand ;
2127import org .apache .ignite .internal .management .rollingupgrade .RollingUpgradeTaskResult ;
2228import org .apache .ignite .lang .IgniteProductVersion ;
@@ -30,6 +36,9 @@ public class RollingUpgradeCommandTest extends GridCommandHandlerClusterByClassA
3036 /** */
3137 public static final String ENABLE = "enable" ;
3238
39+ /** Recording. */
40+ private Recording recording ;
41+
3342 /** */
3443 public static final String DISABLE = "disable" ;
3544
@@ -42,7 +51,6 @@ public class RollingUpgradeCommandTest extends GridCommandHandlerClusterByClassA
4251 /** {@inheritDoc} */
4352 @ Override protected void beforeTestsStarted () throws Exception {
4453 super .beforeTestsStarted ();
45-
4654 autoConfirmation = true ;
4755 }
4856
@@ -56,7 +64,11 @@ public class RollingUpgradeCommandTest extends GridCommandHandlerClusterByClassA
5664
5765 /** */
5866 @ Test
59- public void testEnableAndDisable () {
67+ public void testEnableAndDisable () throws IOException {
68+ recording = new Recording ();
69+ recording .setName ("ignite-jfr" );
70+ recording .start ();
71+
6072 IgniteProductVersion curVer = IgniteProductVersion .fromString (crd .localNode ().attribute (ATTR_BUILD_VER ));
6173
6274 String targetVerStr = curVer .major () + "." + (curVer .minor () + 1 ) + ".0" ;
@@ -85,6 +97,25 @@ public void testEnableAndDisable() {
8597 assertNull (taskRes .targetVersion ());
8698
8799 assertFalse (crd .context ().rollingUpgrade ().enabled ());
100+
101+ Path jfrDir = Paths .get ("target" , "jfr" );
102+ Files .createDirectories (jfrDir );
103+
104+ String fileName = "ignite-jfr-" + System .currentTimeMillis () + ".jfr" ;
105+ Path jfrFile = jfrDir .resolve (fileName );
106+
107+ recording .stop ();
108+ recording .dump (jfrFile );
109+ System .out .println ("✅ JFR saved to: " + jfrFile .toAbsolutePath ());
110+
111+ Path root = findIgniteRoot ();
112+ Path workLog = root .resolve ("work/log" );
113+ Files .createDirectories (workLog );
114+
115+ Path jfrInArtifacts = workLog .resolve ("ignite.jfr" );
116+ Files .copy (jfrFile , jfrInArtifacts , StandardCopyOption .REPLACE_EXISTING );
117+
118+ System .out .println ("📦 Saved JFR to: " + jfrInArtifacts .toAbsolutePath ());
88119 }
89120
90121 /** */
@@ -177,4 +208,24 @@ public void testForceEnable() {
177208
178209 assertTrue (crd .context ().rollingUpgrade ().enabled ());
179210 }
211+
212+ private static Path findIgniteRoot () throws IOException {
213+ Path p = Paths .get ("" ).toAbsolutePath ();
214+
215+ while (p != null ) {
216+ Path pom = p .resolve ("pom.xml" );
217+ if (pom .toFile ().exists ()) {
218+ String content = Files .readString (pom );
219+ // родительский pom содержит секцию <modules>
220+ if (content .contains ("<modules>" ))
221+ return p ;
222+ }
223+
224+ p = p .getParent ();
225+ }
226+
227+ throw new IllegalStateException ("Ignite root not found" );
228+ }
229+
230+
180231}
0 commit comments