Skip to content

Commit

Permalink
[JENKINS-26519] Confirming that it is safe to rerun migration by just…
Browse files Browse the repository at this point in the history
… deleting legacyId files.
  • Loading branch information
jglick committed Jan 21, 2015
1 parent a22843b commit c997ac0
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions core/src/test/java/jenkins/model/RunIdMigratorTest.java
Expand Up @@ -95,6 +95,17 @@ public class RunIdMigratorTest {
assertEquals("{lastFailedBuild=→-1, legacyIds=''}", summarize());
}

@Test public void reRunMigration() throws Exception {
write("2014-01-02_03-04-04/build.xml", "<run>\n <number>98</number>\n</run>");
link("98", "2014-01-02_03-04-04");
write("99/build.xml", "<?xml version='1.0' encoding='UTF-8'?>\n<run>\n <stuff>ok</stuff>\n <timestamp>1388649845000</timestamp>\n <otherstuff>ok</otherstuff>\n</run>");
link("lastFailedBuild", "-1");
link("lastSuccessfulBuild", "99");
assertEquals("{2014-01-02_03-04-04={build.xml='<run>\n <number>98</number>\n</run>'}, 98=→2014-01-02_03-04-04, 99={build.xml='<?xml version='1.0' encoding='UTF-8'?>\n<run>\n <stuff>ok</stuff>\n <timestamp>1388649845000</timestamp>\n <otherstuff>ok</otherstuff>\n</run>'}, lastFailedBuild=→-1, lastSuccessfulBuild=→99}", summarize());
assertTrue(migrator.migrate(dir, null));
assertEquals("{98={build.xml='<run>\n <id>2014-01-02_03-04-04</id>\n <timestamp>1388649844000</timestamp>\n</run>'}, 99={build.xml='<?xml version='1.0' encoding='UTF-8'?>\n<run>\n <stuff>ok</stuff>\n <timestamp>1388649845000</timestamp>\n <otherstuff>ok</otherstuff>\n</run>'}, lastFailedBuild=→-1, lastSuccessfulBuild=→99, legacyIds='2014-01-02_03-04-04 98\n'}", summarize());
}

@Test public void reverseImmediately() throws Exception {
File root = dir;
dir = new File(dir, "jobs/somefolder/jobs/someproject/promotions/OK/builds");
Expand Down

0 comments on commit c997ac0

Please sign in to comment.