mirror of
https://github.com/google/nomulus
synced 2026-09-05 15:46:55 +00:00
Centralize creation of MapreduceRunner in unit tests
This also changes the default number of mapper shards in tests to 2, which is the number of EppResourceIndex buckets in unit tests. Running more shards than there are buckets causes unnecessary test load. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=135520601
This commit is contained in:
@@ -32,6 +32,9 @@ import com.google.appengine.tools.pipeline.impl.servlets.PipelineServlet;
|
||||
import com.google.appengine.tools.pipeline.impl.servlets.TaskHandler;
|
||||
import com.google.apphosting.api.ApiProxy;
|
||||
import com.google.common.base.CharMatcher;
|
||||
import com.google.common.base.Optional;
|
||||
import google.registry.config.RegistryEnvironment;
|
||||
import google.registry.mapreduce.MapreduceRunner;
|
||||
import google.registry.testing.AppEngineRule;
|
||||
import google.registry.testing.FakeClock;
|
||||
import google.registry.testing.ShardableTestCase;
|
||||
@@ -84,6 +87,11 @@ public abstract class MapreduceTestCase<T> extends ShardableTestCase {
|
||||
proxy.setProperty(LocalBlobstoreService.NO_STORAGE_PROPERTY, "true");
|
||||
}
|
||||
|
||||
protected MapreduceRunner makeDefaultRunner() {
|
||||
int numBuckets = RegistryEnvironment.get().config().getEppResourceIndexBucketCount();
|
||||
return new MapreduceRunner(Optional.<Integer>of(numBuckets), Optional.<Integer>of(1));
|
||||
}
|
||||
|
||||
protected List<QueueStateInfo.TaskStateInfo> getTasks(String queueName) {
|
||||
return taskQueue.getQueueStateInfo().get(queueName).getTaskInfo();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user