Turn on memcache in flow tests.

No tests break because of this, but some tests that were previously
intentionally clearing memcache (for example, the test in
DomainInfoFlow that counts datastore calls) are now doing something
that is not a no-op anymore.

Also fix an incorrect comment about memcache in DatastoreHelper.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=154087182
This commit is contained in:
cgoldfeder 2017-04-24 13:15:33 -07:00 committed by Ben McIlwain
parent b15d715dc0
commit b6e50f0467
3 changed files with 16 additions and 2 deletions

View file

@ -21,6 +21,7 @@ import static java.nio.charset.StandardCharsets.UTF_8;
import static org.json.XML.toJSONObject;
import com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig;
import com.google.appengine.tools.development.testing.LocalMemcacheServiceTestConfig;
import com.google.appengine.tools.development.testing.LocalModulesServiceTestConfig;
import com.google.appengine.tools.development.testing.LocalServiceTestConfig;
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
@ -95,6 +96,7 @@ public final class AppEngineRule extends ExternalResource {
private boolean withDatastore;
private boolean withLocalModules;
private boolean withMemcache;
private boolean withTaskQueue;
private boolean withUserService;
private boolean withUrlFetch;
@ -120,6 +122,12 @@ public final class AppEngineRule extends ExternalResource {
return this;
}
/** Turn on the use of local modules. */
public Builder withMemcache() {
rule.withMemcache = true;
return this;
}
/** Turn on the task queue service. */
public Builder withTaskQueue() {
@ -273,6 +281,9 @@ public final class AppEngineRule extends ExternalResource {
.addBasicScalingModuleVersion("tools", "1", 1)
.addBasicScalingModuleVersion("backend", "1", 1));
}
if (withMemcache) {
configs.add(new LocalMemcacheServiceTestConfig());
}
if (withTaskQueue) {
File queueFile = temporaryFolder.newFile("queue.xml");
Files.asCharSink(queueFile, UTF_8).write(taskQueueXml);