mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 07:57:13 +02:00
Remove InetAddress.getLocalHost() from tests
It seems the Bazel sandbox has become stricter at HEAD (which is AWESOME) which caused this error to materialize from the shadows: 9) testExpiredTransfer_subordinateHost(google.registry.model.host.HostResourceTest) java.net.UnknownHostException: sandbox: sandbox: unknown error at java.net.InetAddress.getLocalHost(InetAddress.java:1505) at google.registry.model.host.HostResourceTest.setUp(HostResourceTest.java:82) ... Caused by: java.net.UnknownHostException: sandbox: unknown error at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method) at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928) at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323) at java.net.InetAddress.getLocalHost(InetAddress.java:1500) ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=130700624
This commit is contained in:
parent
1894b2308b
commit
f73e1c06b1
2 changed files with 28 additions and 21 deletions
|
@ -38,6 +38,7 @@ import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
|||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.net.InetAddresses;
|
||||
import com.googlecode.objectify.Key;
|
||||
import com.googlecode.objectify.Ref;
|
||||
import google.registry.flows.EppRequestSource;
|
||||
|
@ -62,7 +63,6 @@ import google.registry.model.host.HostResource;
|
|||
import google.registry.model.index.ForeignKeyIndex;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
import google.registry.testing.TaskQueueHelper.TaskMatcher;
|
||||
import java.net.InetAddress;
|
||||
import javax.annotation.Nullable;
|
||||
import org.joda.time.DateTime;
|
||||
import org.junit.Before;
|
||||
|
@ -756,10 +756,12 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
|
|||
null,
|
||||
null);
|
||||
createTld("tld");
|
||||
persistResource(newHostResource(oldHostName()).asBuilder()
|
||||
.setSuperordinateDomain(Ref.create(persistActiveDomain("example.tld")))
|
||||
.setInetAddresses(ImmutableSet.of(InetAddress.getLocalHost()))
|
||||
.build());
|
||||
persistResource(
|
||||
newHostResource(oldHostName())
|
||||
.asBuilder()
|
||||
.setSuperordinateDomain(Ref.create(persistActiveDomain("example.tld")))
|
||||
.setInetAddresses(ImmutableSet.of(InetAddresses.forString("127.0.0.1")))
|
||||
.build());
|
||||
thrown.expect(RenameHostToExternalRemoveIpException.class);
|
||||
runFlow();
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import static google.registry.testing.DatastoreHelper.persistResource;
|
|||
import static google.registry.testing.HostResourceSubject.assertAboutHosts;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.net.InetAddresses;
|
||||
import com.googlecode.objectify.Key;
|
||||
import com.googlecode.objectify.Ref;
|
||||
import google.registry.model.EntityTestCase;
|
||||
|
@ -71,19 +72,20 @@ public class HostResourceTest extends EntityTestCase {
|
|||
.setTransferRequestTrid(Trid.create("client trid"))
|
||||
.build())
|
||||
.build());
|
||||
hostResource = cloneAndSetAutoTimestamps(
|
||||
new HostResource.Builder()
|
||||
.setRepoId("DEADBEEF-COM")
|
||||
.setFullyQualifiedHostName("ns1.example.com")
|
||||
.setCreationClientId("a registrar")
|
||||
.setLastEppUpdateTime(clock.nowUtc())
|
||||
.setLastEppUpdateClientId("another registrar")
|
||||
.setLastTransferTime(clock.nowUtc())
|
||||
.setInetAddresses(ImmutableSet.of(InetAddress.getLocalHost()))
|
||||
.setStatusValues(ImmutableSet.of(StatusValue.OK))
|
||||
.setSuperordinateDomain(Ref.create(
|
||||
loadByUniqueId(DomainResource.class, "example.com", clock.nowUtc())))
|
||||
.build());
|
||||
hostResource =
|
||||
cloneAndSetAutoTimestamps(
|
||||
new HostResource.Builder()
|
||||
.setRepoId("DEADBEEF-COM")
|
||||
.setFullyQualifiedHostName("ns1.example.com")
|
||||
.setCreationClientId("a registrar")
|
||||
.setLastEppUpdateTime(clock.nowUtc())
|
||||
.setLastEppUpdateClientId("another registrar")
|
||||
.setLastTransferTime(clock.nowUtc())
|
||||
.setInetAddresses(ImmutableSet.of(InetAddresses.forString("127.0.0.1")))
|
||||
.setStatusValues(ImmutableSet.of(StatusValue.OK))
|
||||
.setSuperordinateDomain(
|
||||
Ref.create(loadByUniqueId(DomainResource.class, "example.com", clock.nowUtc())))
|
||||
.build());
|
||||
persistResource(hostResource);
|
||||
}
|
||||
|
||||
|
@ -139,9 +141,12 @@ public class HostResourceTest extends EntityTestCase {
|
|||
assertThat(new HostResource.Builder()
|
||||
.setInetAddresses(ImmutableSet.<InetAddress>of()).build().inetAddresses)
|
||||
.isNull();
|
||||
assertThat(new HostResource.Builder()
|
||||
.setInetAddresses(ImmutableSet.of(InetAddress.getLocalHost())).build().inetAddresses)
|
||||
.isNotNull();
|
||||
assertThat(
|
||||
new HostResource.Builder()
|
||||
.setInetAddresses(ImmutableSet.of(InetAddresses.forString("127.0.0.1")))
|
||||
.build()
|
||||
.inetAddresses)
|
||||
.isNotNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue