mirror of
https://github.com/google/nomulus.git
synced 2025-08-03 16:32:11 +02:00
Use -dot- subdomain notation in MapReduce console links
appspot.com is not provisioned with a multi-level wildcard SSL certificate, so URLs of the form https://service.projectid.appspot.com/path need to be rewritten as https://service-dot-projectid.appspot.com/path (and same for version names). This is a follow-up to [] ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=231418795
This commit is contained in:
parent
6e0b8f2cfd
commit
3812c2ceda
7 changed files with 85 additions and 6 deletions
|
@ -94,7 +94,8 @@ public class ExportDomainListsActionTest extends MapreduceTestCase<ExportDomainL
|
|||
runMapreduce();
|
||||
assertThat(response.getPayload())
|
||||
.startsWith(
|
||||
"Mapreduce console: https://backend.hostname.tld/_ah/pipeline/status.html?root=");
|
||||
"Mapreduce console: https://backend-dot-projectid.appspot.com"
|
||||
+ "/_ah/pipeline/status.html?root=");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -20,6 +20,7 @@ import static org.mockito.Mockito.mock;
|
|||
import static org.mockito.Mockito.when;
|
||||
|
||||
import com.google.appengine.api.blobstore.dev.LocalBlobstoreService;
|
||||
import com.google.appengine.api.modules.ModulesService;
|
||||
import com.google.appengine.api.taskqueue.dev.LocalTaskQueue;
|
||||
import com.google.appengine.api.taskqueue.dev.QueueStateInfo;
|
||||
import com.google.appengine.api.taskqueue.dev.QueueStateInfo.HeaderWrapper;
|
||||
|
@ -38,6 +39,7 @@ import google.registry.testing.FakeClock;
|
|||
import google.registry.testing.MockitoJUnitRule;
|
||||
import google.registry.testing.ShardableTestCase;
|
||||
import google.registry.util.AppEngineServiceUtils;
|
||||
import google.registry.util.AppEngineServiceUtilsImpl;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
@ -84,16 +86,19 @@ public abstract class MapreduceTestCase<T> extends ShardableTestCase {
|
|||
|
||||
@Rule public final MockitoJUnitRule mocks = MockitoJUnitRule.create();
|
||||
|
||||
@Mock
|
||||
AppEngineServiceUtils appEngineServiceUtils;
|
||||
|
||||
@Mock ModulesService modulesService;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
taskQueue = LocalTaskQueueTestConfig.getLocalTaskQueue();
|
||||
ApiProxyLocal proxy = (ApiProxyLocal) ApiProxy.getDelegate();
|
||||
// Creating files is not allowed in some test execution environments, so don't.
|
||||
proxy.setProperty(LocalBlobstoreService.NO_STORAGE_PROPERTY, "true");
|
||||
when(appEngineServiceUtils.getServiceHostname("backend")).thenReturn("backend.hostname.tld");
|
||||
appEngineServiceUtils = new AppEngineServiceUtilsImpl(modulesService);
|
||||
when(modulesService.getVersionHostname("backend", null))
|
||||
.thenReturn("version.backend.projectid.appspot.com");
|
||||
}
|
||||
|
||||
protected MapreduceRunner makeDefaultRunner() {
|
||||
|
|
|
@ -132,7 +132,8 @@ public class GenerateZoneFilesActionTest extends MapreduceTestCase<GenerateZoneF
|
|||
assertThat(response).containsKey("mapreduceConsoleLink");
|
||||
assertThat(response.get("mapreduceConsoleLink").toString())
|
||||
.startsWith(
|
||||
"Mapreduce console: https://backend.hostname.tld/_ah/pipeline/status.html?root=");
|
||||
"Mapreduce console: https://backend-dot-projectid.appspot.com"
|
||||
+ "/_ah/pipeline/status.html?root=");
|
||||
|
||||
executeTasksUntilEmpty("mapreduce");
|
||||
|
||||
|
|
|
@ -110,4 +110,37 @@ public class AppEngineServiceUtilsImplTest {
|
|||
() -> appEngineServiceUtils.setNumInstances("service", "version", -10L));
|
||||
assertThat(thrown).hasMessageThat().isEqualTo("Number of instances must be greater than 0");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_convertToSingleSubdomain_doesNothingWithoutServiceOrHostname() {
|
||||
assertThat(appEngineServiceUtils.convertToSingleSubdomain("projectid.appspot.com"))
|
||||
.isEqualTo("projectid.appspot.com");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_convertToSingleSubdomain_doesNothingWhenItCannotParseCorrectly() {
|
||||
assertThat(appEngineServiceUtils.convertToSingleSubdomain("garbage.notrealhost.example"))
|
||||
.isEqualTo("garbage.notrealhost.example");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_convertToSingleSubdomain_convertsWithServiceName() {
|
||||
assertThat(appEngineServiceUtils.convertToSingleSubdomain("service.projectid.appspot.com"))
|
||||
.isEqualTo("service-dot-projectid.appspot.com");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_convertToSingleSubdomain_convertsWithVersionAndServiceName() {
|
||||
assertThat(
|
||||
appEngineServiceUtils.convertToSingleSubdomain("version.service.projectid.appspot.com"))
|
||||
.isEqualTo("version-dot-service-dot-projectid.appspot.com");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_convertToSingleSubdomain_convertsWithInstanceAndVersionAndServiceName() {
|
||||
assertThat(
|
||||
appEngineServiceUtils.convertToSingleSubdomain(
|
||||
"instanceid.version.service.projectid.appspot.com"))
|
||||
.isEqualTo("instanceid-dot-version-dot-service-dot-projectid.appspot.com");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue