Add a 'Host' parameter to the relock action enqueuer (#699)

* Add a 'Host' parameter to the relock action enqueuer

I believe this is why we are seeing 404s currently -- we should be
specifying the backend host as the target like we do for the
resave-entity async action.
This commit is contained in:
gbrodman 2020-07-17 15:35:44 -04:00 committed by GitHub
parent d10aea2ff1
commit 627fe662af
3 changed files with 14 additions and 6 deletions

View file

@ -168,6 +168,7 @@ public class AsyncTaskEnqueuerTest {
new TaskMatcher()
.url(RelockDomainAction.PATH)
.method("POST")
.header("Host", "backend.hostname.fake")
.param(
RelockDomainAction.OLD_UNLOCK_REVISION_ID_PARAM,
String.valueOf(lock.getRevisionId()))

View file

@ -33,6 +33,7 @@ import static org.joda.time.Duration.standardHours;
import static org.joda.time.Duration.standardSeconds;
import static org.junit.Assert.assertThrows;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import com.google.common.collect.ImmutableList;
import google.registry.batch.AsyncTaskEnqueuerTest;
@ -71,12 +72,7 @@ public final class DomainLockUtilsTest {
private static final String POC_ID = "marla.singer@example.com";
private final FakeClock clock = new FakeClock(DateTime.now(DateTimeZone.UTC));
private final DomainLockUtils domainLockUtils =
new DomainLockUtils(
new DeterministicStringGenerator(Alphabets.BASE_58),
"adminreg",
AsyncTaskEnqueuerTest.createForTesting(
mock(AppEngineServiceUtils.class), clock, standardSeconds(90)));
private DomainLockUtils domainLockUtils;
@Rule
public final AppEngineRule appEngineRule =
@ -94,6 +90,14 @@ public final class DomainLockUtilsTest {
createTlds("tld", "net");
HostResource host = persistActiveHost("ns1.example.net");
domain = persistResource(newDomainBase(DOMAIN_NAME, host));
AppEngineServiceUtils appEngineServiceUtils = mock(AppEngineServiceUtils.class);
when(appEngineServiceUtils.getServiceHostname("backend")).thenReturn("backend.hostname.fake");
domainLockUtils = new DomainLockUtils(
new DeterministicStringGenerator(Alphabets.BASE_58),
"adminreg",
AsyncTaskEnqueuerTest.createForTesting(
appEngineServiceUtils, clock, standardSeconds(90)));
}
@Test
@ -264,6 +268,7 @@ public final class DomainLockUtilsTest {
new TaskMatcher()
.url(RelockDomainAction.PATH)
.method("POST")
.header("Host", "backend.hostname.fake")
.param(
RelockDomainAction.OLD_UNLOCK_REVISION_ID_PARAM,
String.valueOf(lock.getRevisionId()))