Change the LoadTestAction to use /_dr/epptool

The load tests used to directly build EPP, but that becomes
problematic for an upcoming CL that refactors a lot of the
EPP flow code. Instead, use the existing tool endpoint
(conveniently, LoadTestAction is already in the tools module).
This required changing the EppToolServlet to get its
xml from a param rather than from the request payload,
since task queues won't allow both a payload and request
params on the same task.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=124351878
This commit is contained in:
Corey Goldfeder 2016-06-08 07:51:02 -07:00 committed by Justine Tunney
parent 5a2f63cf58
commit 366c5a344d
19 changed files with 227 additions and 255 deletions

View file

@ -19,6 +19,10 @@ import static java.nio.charset.StandardCharsets.UTF_8;
import com.beust.jcommander.ParameterException;
import google.registry.testing.InjectRule;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import java.io.ByteArrayInputStream;
@ -26,11 +30,14 @@ import java.io.ByteArrayInputStream;
/** Unit tests for {@link ExecuteEppCommand}. */
public class ExecuteEppCommandTest extends EppToolCommandTestCase<ExecuteEppCommand> {
@Rule
public InjectRule inject = new InjectRule();
private String xmlInput;
private String eppFile;
@Override
void initEppToolCommandTestCase() throws Exception {
@Before
public void initCommand() throws Exception {
xmlInput = readResourceUtf8(ExecuteEppCommandTest.class, "testdata/contact_create.xml");
eppFile = writeToNamedTmpFile("eppFile", xmlInput);
}
@ -38,19 +45,19 @@ public class ExecuteEppCommandTest extends EppToolCommandTestCase<ExecuteEppComm
@Test
public void testSuccess() throws Exception {
runCommand("--client=NewRegistrar", "--force", eppFile);
eppVerifier().verifySent("testdata/contact_create.xml");
eppVerifier().verifySent("contact_create.xml");
}
@Test
public void testSuccess_dryRun() throws Exception {
runCommand("--client=NewRegistrar", "--dry_run", eppFile);
eppVerifier().asDryRun().verifySent("testdata/contact_create.xml");
eppVerifier().asDryRun().verifySent("contact_create.xml");
}
@Test
public void testSuccess_withSuperuser() throws Exception {
runCommand("--client=NewRegistrar", "--superuser", "--force", eppFile);
eppVerifier().asSuperuser().verifySent("testdata/contact_create.xml");
eppVerifier().asSuperuser().verifySent("contact_create.xml");
}
@Test
@ -58,7 +65,7 @@ public class ExecuteEppCommandTest extends EppToolCommandTestCase<ExecuteEppComm
inject.setStaticField(
ExecuteEppCommand.class, "stdin", new ByteArrayInputStream(xmlInput.getBytes(UTF_8)));
runCommand("--client=NewRegistrar", "--force");
eppVerifier().verifySent("testdata/contact_create.xml");
eppVerifier().verifySent("contact_create.xml");
}
@Test
@ -66,7 +73,7 @@ public class ExecuteEppCommandTest extends EppToolCommandTestCase<ExecuteEppComm
String xmlInput2 = readResourceUtf8(ExecuteEppCommandTest.class, "testdata/domain_check.xml");
String eppFile2 = writeToNamedTmpFile("eppFile2", xmlInput2);
runCommand("--client=NewRegistrar", "--force", eppFile, eppFile2);
eppVerifier().verifySent("testdata/contact_create.xml", "testdata/domain_check.xml");
eppVerifier().verifySent("contact_create.xml", "domain_check.xml");
}
@Test