7373
7474import org .apache .flink .shaded .guava33 .com .google .common .collect .Iterables ;
7575
76+ import org .assertj .core .api .Fail ;
7677import org .junit .AfterClass ;
7778import org .junit .BeforeClass ;
7879import org .junit .Rule ;
@@ -150,7 +151,7 @@ public static void afterAll() {
150151 }
151152
152153 @ Nullable
153- protected File execute (UnalignedSettings settings ) throws Exception {
154+ protected String execute (UnalignedSettings settings ) throws Exception {
154155 final File checkpointDir = temp .newFolder ();
155156 Configuration conf = settings .getConfiguration (checkpointDir );
156157
@@ -179,14 +180,15 @@ protected File execute(UnalignedSettings settings) throws Exception {
179180 final StreamExecutionEnvironment env =
180181 StreamExecutionEnvironment .getExecutionEnvironment (conf );
181182 settings .configure (env );
183+ JobID jobID = null ;
182184 try {
183185 // print the test parameters to help debugging when the case is stuck
184186 System .out .println (
185187 "Starting " + getClass ().getCanonicalName () + "#" + name .getMethodName () + "." );
186188 final CompletableFuture <JobSubmissionResult > result =
187189 miniCluster .getMiniCluster ().submitJob (streamGraph .getJobGraph ());
188190
189- final JobID jobID = result .get ().getJobID ();
191+ jobID = result .get ().getJobID ();
190192 checkCounters (
191193 miniCluster
192194 .getMiniCluster ()
@@ -198,13 +200,17 @@ protected File execute(UnalignedSettings settings) throws Exception {
198200 if (settings .generateCheckpoint ) {
199201 return CommonTestUtils .getLatestCompletedCheckpointPath (
200202 jobID , miniCluster .getMiniCluster ())
201- .map (File ::new )
202- .orElseThrow (() -> new AssertionError ("Could not generate checkpoint" ));
203+ .orElseThrow (() -> Fail .fail ("Could not generate checkpoint" ));
203204 }
204205 } catch (Exception e ) {
205206 if (ExceptionUtils .findThrowable (e , TestException .class ).isEmpty ()) {
206207 throw e ;
207208 }
209+ if (settings .generateCheckpoint ) {
210+ return CommonTestUtils .getLatestCompletedCheckpointPath (
211+ jobID , miniCluster .getMiniCluster ())
212+ .orElseThrow (() -> Fail .fail ("Could not generate checkpoint" ));
213+ }
208214 } finally {
209215 miniCluster .after ();
210216 }
@@ -680,7 +686,7 @@ public String toString() {
680686 protected static class UnalignedSettings {
681687 private int parallelism ;
682688 private final int minCheckpoints = 10 ;
683- @ Nullable private File restoreCheckpoint ;
689+ @ Nullable private String restoreCheckpoint ;
684690 private boolean generateCheckpoint = false ;
685691 int expectedFailures = 0 ;
686692 int tolerableCheckpointFailures = 0 ;
@@ -701,7 +707,7 @@ public UnalignedSettings setParallelism(int parallelism) {
701707 return this ;
702708 }
703709
704- public UnalignedSettings setRestoreCheckpoint (File restoreCheckpoint ) {
710+ public UnalignedSettings setRestoreCheckpoint (String restoreCheckpoint ) {
705711 this .restoreCheckpoint = restoreCheckpoint ;
706712 return this ;
707713 }
@@ -772,7 +778,7 @@ public Configuration getConfiguration(File checkpointDir) {
772778 conf .set (StateBackendOptions .STATE_BACKEND , "hashmap" );
773779 conf .set (CheckpointingOptions .CHECKPOINTS_DIRECTORY , checkpointDir .toURI ().toString ());
774780 if (restoreCheckpoint != null ) {
775- conf .set (StateRecoveryOptions .SAVEPOINT_PATH , restoreCheckpoint . toURI (). toString () );
781+ conf .set (StateRecoveryOptions .SAVEPOINT_PATH , restoreCheckpoint );
776782 }
777783
778784 conf .set (
0 commit comments