mirror of
https://github.com/google/nomulus.git
synced 2025-04-30 12:07:51 +02:00
Modify the CreateSynthetic pipeline to run over all non-deleted domains (#1803)
This commit is contained in:
parent
63b218a0b8
commit
916f746af9
2 changed files with 8 additions and 13 deletions
|
@ -61,21 +61,14 @@ public class CreateSyntheticDomainHistoriesPipeline implements Serializable {
|
||||||
"Create synthetic domain histories to fix RDE for b/248112997";
|
"Create synthetic domain histories to fix RDE for b/248112997";
|
||||||
private static final DateTime BAD_PIPELINE_START_TIME =
|
private static final DateTime BAD_PIPELINE_START_TIME =
|
||||||
DateTime.parse("2022-09-05T09:00:00.000Z");
|
DateTime.parse("2022-09-05T09:00:00.000Z");
|
||||||
private static final DateTime BAD_PIPELINE_END_TIME = DateTime.parse("2022-09-10T12:00:00.000Z");
|
|
||||||
|
|
||||||
static void setup(Pipeline pipeline, String registryAdminRegistrarId) {
|
static void setup(Pipeline pipeline, String registryAdminRegistrarId) {
|
||||||
pipeline
|
pipeline
|
||||||
.apply(
|
.apply(
|
||||||
"Read all domain repo IDs",
|
"Read all domain repo IDs",
|
||||||
RegistryJpaIO.read(
|
RegistryJpaIO.read(
|
||||||
"SELECT d.repoId FROM Domain d WHERE deletionTime > :badPipelineStartTime AND NOT"
|
"SELECT d.repoId FROM Domain d WHERE deletionTime > :badPipelineStartTime",
|
||||||
+ " EXISTS (SELECT 1 FROM DomainHistory dh WHERE dh.domainRepoId = d.repoId"
|
ImmutableMap.of("badPipelineStartTime", BAD_PIPELINE_START_TIME),
|
||||||
+ " AND dh.modificationTime > :badPipelineEndTime)",
|
|
||||||
ImmutableMap.of(
|
|
||||||
"badPipelineStartTime",
|
|
||||||
BAD_PIPELINE_START_TIME,
|
|
||||||
"badPipelineEndTime",
|
|
||||||
BAD_PIPELINE_END_TIME),
|
|
||||||
String.class,
|
String.class,
|
||||||
repoId -> VKey.createSql(Domain.class, repoId)))
|
repoId -> VKey.createSql(Domain.class, repoId)))
|
||||||
.apply(
|
.apply(
|
||||||
|
|
|
@ -98,11 +98,13 @@ public class CreateSyntheticDomainHistoriesPipelineTest {
|
||||||
assertAboutImmutableObjects()
|
assertAboutImmutableObjects()
|
||||||
.that(syntheticHistory.getDomainBase().get())
|
.that(syntheticHistory.getDomainBase().get())
|
||||||
.isEqualExceptFields(domain, "updateTimestamp");
|
.isEqualExceptFields(domain, "updateTimestamp");
|
||||||
|
// four total histories, two CREATE and two SYNTHETIC
|
||||||
|
assertThat(loadAllOf(DomainHistory.class)).hasSize(4);
|
||||||
|
|
||||||
// shouldn't create any entries on re-run
|
// can create multiple entries if we run it multiple times
|
||||||
pipeline.run().waitUntilFinish();
|
pipeline.run().waitUntilFinish();
|
||||||
assertThat(HistoryEntryDao.loadHistoryObjectsForResource(domain.createVKey())).hasSize(2);
|
assertThat(HistoryEntryDao.loadHistoryObjectsForResource(domain.createVKey())).hasSize(3);
|
||||||
// three total histories, two CREATE and one SYNTHETIC
|
// six total histories, two CREATE and four SYNTHETIC
|
||||||
assertThat(loadAllOf(DomainHistory.class)).hasSize(3);
|
assertThat(loadAllOf(DomainHistory.class)).hasSize(6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue