mirror of
https://github.com/google/nomulus.git
synced 2025-05-17 17:59:41 +02:00
Make the new datastore testing proxy actually store the requests
This will improve error messages and allow for easier debugging ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=123893831
This commit is contained in:
parent
aa10792f73
commit
89066a7215
3 changed files with 36 additions and 30 deletions
|
@ -16,6 +16,7 @@ package google.registry.model.domain;
|
|||
|
||||
import static com.google.appengine.tools.development.testing.LocalMemcacheServiceTestConfig.getLocalMemcacheService;
|
||||
import static com.google.common.collect.Iterables.getOnlyElement;
|
||||
import static com.google.common.collect.Iterables.skip;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.model.EppResourceUtils.loadByUniqueId;
|
||||
import static google.registry.testing.DatastoreHelper.cloneAndSetAutoTimestamps;
|
||||
|
@ -54,7 +55,7 @@ import google.registry.model.eppoutput.Response;
|
|||
import google.registry.model.eppoutput.Result;
|
||||
import google.registry.model.eppoutput.Result.Code;
|
||||
import google.registry.model.host.HostResource;
|
||||
import google.registry.model.ofy.RequestCountingAsyncDatastoreService;
|
||||
import google.registry.model.ofy.RequestCapturingAsyncDatastoreService;
|
||||
import google.registry.model.poll.PollMessage;
|
||||
import google.registry.model.registry.Registry;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
|
@ -432,7 +433,7 @@ public class DomainResourceTest extends EntityTestCase {
|
|||
// Clear out memcache so that we count actual datastore calls.
|
||||
getLocalMemcacheService().flushAll(
|
||||
new LocalRpcService.Status(), MemcacheFlushRequest.newBuilder().build());
|
||||
int previousReads = RequestCountingAsyncDatastoreService.getReadsCount();
|
||||
int numPreviousReads = RequestCapturingAsyncDatastoreService.getReads().size();
|
||||
EppXmlTransformer.marshal(
|
||||
EppOutput.create(new Response.Builder()
|
||||
.setResult(Result.create(Code.Success))
|
||||
|
@ -440,6 +441,7 @@ public class DomainResourceTest extends EntityTestCase {
|
|||
.setTrid(Trid.create(null, "abc"))
|
||||
.build()),
|
||||
ValidationMode.STRICT);
|
||||
assertThat(RequestCountingAsyncDatastoreService.getReadsCount() - previousReads).isEqualTo(1);
|
||||
// Assert that there was only one call to datastore (that may have loaded many keys).
|
||||
assertThat(skip(RequestCapturingAsyncDatastoreService.getReads(), numPreviousReads)).hasSize(1);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue