Skip to content

Commit

Permalink
Fixes for tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
gianm committed Jan 29, 2025
1 parent d537128 commit 94cdbe9
Showing 1 changed file with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ public void setup()
.withCleanupPeriod(Duration.standardSeconds(0))
.withDurationToRetain(Duration.standardHours(36))
.withMaxSegmentsToKill(10)
.withMaxIntervalToKill(Period.ZERO)
.withBufferPeriod(Duration.standardSeconds(1));
dynamicConfigBuilder = CoordinatorDynamicConfig.builder()
.withKillTaskSlotRatio(1.0);
Expand All @@ -157,6 +158,33 @@ public void testKillWithDefaultCoordinatorConfig()
initDuty();
final CoordinatorRunStats stats = runDutyAndGetStats();

Assert.assertEquals(1, stats.get(Stats.Kill.AVAILABLE_SLOTS));
Assert.assertEquals(1, stats.get(Stats.Kill.SUBMITTED_TASKS));
Assert.assertEquals(1, stats.get(Stats.Kill.MAX_SLOTS));
Assert.assertEquals(1, stats.get(Stats.Kill.ELIGIBLE_UNUSED_SEGMENTS, DS1_STAT_KEY));

validateLastKillStateAndReset(DS1, Intervals.ETERNITY);
}

@Test
public void testKillWithDefaultCoordinatorConfigPlusZeroMaxIntervalToKill()
{
configBuilder = KillUnusedSegmentsConfig.builder().withMaxIntervalToKill(Period.ZERO);
dynamicConfigBuilder = CoordinatorDynamicConfig.builder();

final DateTime sixtyDaysAgo = NOW.minusDays(60);

createAndAddUnusedSegment(DS1, YEAR_OLD, VERSION, sixtyDaysAgo);
createAndAddUnusedSegment(DS1, MONTH_OLD, VERSION, sixtyDaysAgo);
createAndAddUnusedSegment(DS1, DAY_OLD, VERSION, sixtyDaysAgo);
createAndAddUnusedSegment(DS1, HOUR_OLD, VERSION, sixtyDaysAgo);
createAndAddUnusedSegment(DS1, NEXT_DAY, VERSION, sixtyDaysAgo);
createAndAddUnusedSegment(DS1, NEXT_MONTH, VERSION, sixtyDaysAgo);
createAndAddUnusedSegment(DS1, Intervals.ETERNITY, VERSION, sixtyDaysAgo);

initDuty();
final CoordinatorRunStats stats = runDutyAndGetStats();

Assert.assertEquals(1, stats.get(Stats.Kill.AVAILABLE_SLOTS));
Assert.assertEquals(1, stats.get(Stats.Kill.SUBMITTED_TASKS));
Assert.assertEquals(1, stats.get(Stats.Kill.MAX_SLOTS));
Expand Down

0 comments on commit 94cdbe9

Please sign in to comment.