Skip to content

Commit

Permalink
Fix UT RoutineLoadManagerTest.testExpired 2 (StarRocks#6908)
Browse files Browse the repository at this point in the history
This UT failed because the time setting was not good. The time was changed after the metadata was saved, and there was a logic to re-read the metadata. At this time, the previously set time was invalid, which caused the UT to always fail. so. Just put this setup time before the save element.
  • Loading branch information
Astralidea authored Jun 6, 2022
1 parent 79538d4 commit 269dede
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -838,6 +838,9 @@ public void testExpired(@Mocked GlobalStateMgr globalStateMgr, @Mocked GlobalTra
loadManager.replayChangeRoutineLoadJob(new RoutineLoadOperation(goodJob.getId(), RoutineLoadJob.JobState.CANCELLED));
Assert.assertEquals(2, idToRoutineLoadJob.size());

// 3. make sure it can not be clean
idToRoutineLoadJob.get(goodJob.getId()).endTimestamp = System.currentTimeMillis() + 100000L;

// 5. save image
File tempFile = File.createTempFile("RoutineLoadManagerTest", ".image");
System.err.println("write image " + tempFile.getAbsolutePath());
Expand All @@ -846,9 +849,6 @@ public void testExpired(@Mocked GlobalStateMgr globalStateMgr, @Mocked GlobalTra
long saveChecksum = loadManager.saveRoutineLoadJobs(dos, checksum);
dos.close();

// make sure it can not be clean
idToRoutineLoadJob.get(goodJob.getId()).endTimestamp = System.currentTimeMillis() + 100000L;

// 6. clean expire
loadManager.cleanOldRoutineLoadJobs();
Assert.assertEquals(1, idToRoutineLoadJob.size());
Expand Down

0 comments on commit 269dede

Please sign in to comment.