mirror of
https://github.com/google/nomulus.git
synced 2025-06-12 23:44:46 +02:00
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:
parent
d10aea2ff1
commit
627fe662af
3 changed files with 14 additions and 6 deletions
|
@ -169,10 +169,12 @@ public final class AsyncTaskEnqueuer {
|
||||||
lock.getRelockDuration().isPresent(),
|
lock.getRelockDuration().isPresent(),
|
||||||
"Lock with ID %s not configured for relock",
|
"Lock with ID %s not configured for relock",
|
||||||
lock.getRevisionId());
|
lock.getRevisionId());
|
||||||
|
String backendHostname = appEngineServiceUtils.getServiceHostname("backend");
|
||||||
addTaskToQueueWithRetry(
|
addTaskToQueueWithRetry(
|
||||||
asyncActionsPushQueue,
|
asyncActionsPushQueue,
|
||||||
TaskOptions.Builder.withUrl(RelockDomainAction.PATH)
|
TaskOptions.Builder.withUrl(RelockDomainAction.PATH)
|
||||||
.method(Method.POST)
|
.method(Method.POST)
|
||||||
|
.header("Host", backendHostname)
|
||||||
.param(
|
.param(
|
||||||
RelockDomainAction.OLD_UNLOCK_REVISION_ID_PARAM,
|
RelockDomainAction.OLD_UNLOCK_REVISION_ID_PARAM,
|
||||||
String.valueOf(lock.getRevisionId()))
|
String.valueOf(lock.getRevisionId()))
|
||||||
|
|
|
@ -168,6 +168,7 @@ public class AsyncTaskEnqueuerTest {
|
||||||
new TaskMatcher()
|
new TaskMatcher()
|
||||||
.url(RelockDomainAction.PATH)
|
.url(RelockDomainAction.PATH)
|
||||||
.method("POST")
|
.method("POST")
|
||||||
|
.header("Host", "backend.hostname.fake")
|
||||||
.param(
|
.param(
|
||||||
RelockDomainAction.OLD_UNLOCK_REVISION_ID_PARAM,
|
RelockDomainAction.OLD_UNLOCK_REVISION_ID_PARAM,
|
||||||
String.valueOf(lock.getRevisionId()))
|
String.valueOf(lock.getRevisionId()))
|
||||||
|
|
|
@ -33,6 +33,7 @@ import static org.joda.time.Duration.standardHours;
|
||||||
import static org.joda.time.Duration.standardSeconds;
|
import static org.joda.time.Duration.standardSeconds;
|
||||||
import static org.junit.Assert.assertThrows;
|
import static org.junit.Assert.assertThrows;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import google.registry.batch.AsyncTaskEnqueuerTest;
|
import google.registry.batch.AsyncTaskEnqueuerTest;
|
||||||
|
@ -71,12 +72,7 @@ public final class DomainLockUtilsTest {
|
||||||
private static final String POC_ID = "marla.singer@example.com";
|
private static final String POC_ID = "marla.singer@example.com";
|
||||||
|
|
||||||
private final FakeClock clock = new FakeClock(DateTime.now(DateTimeZone.UTC));
|
private final FakeClock clock = new FakeClock(DateTime.now(DateTimeZone.UTC));
|
||||||
private final DomainLockUtils domainLockUtils =
|
private DomainLockUtils domainLockUtils;
|
||||||
new DomainLockUtils(
|
|
||||||
new DeterministicStringGenerator(Alphabets.BASE_58),
|
|
||||||
"adminreg",
|
|
||||||
AsyncTaskEnqueuerTest.createForTesting(
|
|
||||||
mock(AppEngineServiceUtils.class), clock, standardSeconds(90)));
|
|
||||||
|
|
||||||
@Rule
|
@Rule
|
||||||
public final AppEngineRule appEngineRule =
|
public final AppEngineRule appEngineRule =
|
||||||
|
@ -94,6 +90,14 @@ public final class DomainLockUtilsTest {
|
||||||
createTlds("tld", "net");
|
createTlds("tld", "net");
|
||||||
HostResource host = persistActiveHost("ns1.example.net");
|
HostResource host = persistActiveHost("ns1.example.net");
|
||||||
domain = persistResource(newDomainBase(DOMAIN_NAME, host));
|
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
|
@Test
|
||||||
|
@ -264,6 +268,7 @@ public final class DomainLockUtilsTest {
|
||||||
new TaskMatcher()
|
new TaskMatcher()
|
||||||
.url(RelockDomainAction.PATH)
|
.url(RelockDomainAction.PATH)
|
||||||
.method("POST")
|
.method("POST")
|
||||||
|
.header("Host", "backend.hostname.fake")
|
||||||
.param(
|
.param(
|
||||||
RelockDomainAction.OLD_UNLOCK_REVISION_ID_PARAM,
|
RelockDomainAction.OLD_UNLOCK_REVISION_ID_PARAM,
|
||||||
String.valueOf(lock.getRevisionId()))
|
String.valueOf(lock.getRevisionId()))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue