Support independent application migration versions.

This commit is contained in:
Greyson Parrelli
2019-09-05 14:39:18 -04:00
parent f81c0b448e
commit d1a6582ad7
11 changed files with 158 additions and 63 deletions

View File

@@ -380,6 +380,23 @@ public class FastJobStorageTest {
assertEquals("1", jobs.get(0).getId());
}
@Test
public void getPendingJobsWithNoDependenciesInCreatedOrder_onlyMigrationJobWithAppropriateNextRunTime() {
FullSpec migrationSpec1 = new FullSpec(new JobSpec("1", "f1", Job.Parameters.MIGRATION_QUEUE_KEY, 0, 999, 0, 0, 0, -1, -1, EMPTY_DATA, false),
Collections.emptyList(),
Collections.emptyList());
FullSpec migrationSpec2 = new FullSpec(new JobSpec("2", "f2", Job.Parameters.MIGRATION_QUEUE_KEY, 5, 0, 0, 0, 0, -1, -1, EMPTY_DATA, false),
Collections.emptyList(),
Collections.emptyList());
FastJobStorage subject = new FastJobStorage(fixedDataDatabase(Arrays.asList(migrationSpec1, migrationSpec2)));
subject.init();
List<JobSpec> jobs = subject.getPendingJobsWithNoDependenciesInCreatedOrder(10);
assertTrue(jobs.isEmpty());
}
@Test
public void deleteJobs_writesToDatabase() {
JobDatabase database = noopDatabase();