mirror of
https://github.com/google/nomulus.git
synced 2025-05-16 17:37:13 +02:00
Make the verify OT&E action more performant
As previously written, it loaded up all history entries into memory and then processed them. This was OOMing for some registrars on sandbox who had performed a large number of testing actions, most of them long OT&E was passed. This commit changes the verify OT&E action to stream the history entries in batches, ordered by when they were made, and then terminates once all tests have passed. This prevents OOMing because only a single batch of history entries need reside in memory at once. This does necessitate the creation of a new composite Datastore index on HistoryEntry, so we'll need to run the ResaveAllHistoryEntriesAction in sandbox after this change is deployed before the new verify OT&E code will work. Note that the "history viewer" is long dead, but that the pre-existing index on HistoryEntries is still used for many other purposes. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=223163337
This commit is contained in:
parent
4416601a1d
commit
c2ee453745
4 changed files with 60 additions and 25 deletions
|
@ -17,9 +17,11 @@ package google.registry.tools.server;
|
|||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.DatastoreHelper.deleteResource;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import google.registry.model.eppcommon.Trid;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
import google.registry.model.reporting.HistoryEntry.Type;
|
||||
import google.registry.testing.AppEngineRule;
|
||||
|
@ -40,9 +42,9 @@ public class VerifyOteActionTest {
|
|||
|
||||
private final VerifyOteAction action = new VerifyOteAction();
|
||||
|
||||
HistoryEntry hostDeleteHistoryEntry;
|
||||
HistoryEntry domainCreateHistoryEntry;
|
||||
HistoryEntry domainRestoreHistoryEntry;
|
||||
private HistoryEntry hostDeleteHistoryEntry;
|
||||
private HistoryEntry domainCreateHistoryEntry;
|
||||
private HistoryEntry domainRestoreHistoryEntry;
|
||||
|
||||
@Before
|
||||
public void init() throws Exception {
|
||||
|
@ -137,12 +139,19 @@ public class VerifyOteActionTest {
|
|||
.setType(Type.HOST_DELETE)
|
||||
.setXmlBytes(ToolsTestData.loadBytes("host_delete.xml").read())
|
||||
.build());
|
||||
persistResource(
|
||||
new HistoryEntry.Builder()
|
||||
.setClientId("blobio-1")
|
||||
.setType(Type.HOST_UPDATE)
|
||||
.setXmlBytes(ToolsTestData.loadBytes("host_update.xml").read())
|
||||
.build());
|
||||
// Persist 10 host updates for a total of 25 history entries. Since these also sort last by
|
||||
// modification time, when these cause all tests to pass, only the first will be recorded and
|
||||
// the rest will be skipped.
|
||||
for (int i = 0; i < 10; i++) {
|
||||
persistResource(
|
||||
new HistoryEntry.Builder()
|
||||
.setClientId("blobio-1")
|
||||
.setType(Type.HOST_UPDATE)
|
||||
.setXmlBytes(ToolsTestData.loadBytes("host_update.xml").read())
|
||||
.setTrid(Trid.create(null, String.format("blahtrid-%d", i)))
|
||||
.setModificationTime(END_OF_TIME)
|
||||
.build());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -165,7 +174,7 @@ public class VerifyOteActionTest {
|
|||
ImmutableMap.of("summarize", "true", "registrars", ImmutableList.of("blobio")));
|
||||
assertThat(response)
|
||||
.containsExactly(
|
||||
"blobio", "# actions: 26 - Reqs: [-.-----.------.-] 13/16 - Overall: FAIL");
|
||||
"blobio", "# actions: 35 - Reqs: [-.-----.------.-] 13/16 - Overall: FAIL");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -235,7 +244,7 @@ public class VerifyOteActionTest {
|
|||
+ ".*"
|
||||
+ "host creates subordinate: 1\n"
|
||||
+ "host deletes: 0\n"
|
||||
+ "host updates: 1\n"
|
||||
+ "host updates: 10\n"
|
||||
+ ".*"
|
||||
+ "Requirements passed: 15/16\n"
|
||||
+ "Overall OT&E status: FAIL\n";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue