mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 16:07:15 +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.ImmutableMap;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
import com.google.common.net.InetAddresses;
|
||||||
import com.googlecode.objectify.Key;
|
import com.googlecode.objectify.Key;
|
||||||
import com.googlecode.objectify.Ref;
|
import com.googlecode.objectify.Ref;
|
||||||
import google.registry.flows.EppRequestSource;
|
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.index.ForeignKeyIndex;
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
import google.registry.testing.TaskQueueHelper.TaskMatcher;
|
import google.registry.testing.TaskQueueHelper.TaskMatcher;
|
||||||
import java.net.InetAddress;
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
@ -756,10 +756,12 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
|
||||||
null,
|
null,
|
||||||
null);
|
null);
|
||||||
createTld("tld");
|
createTld("tld");
|
||||||
persistResource(newHostResource(oldHostName()).asBuilder()
|
persistResource(
|
||||||
.setSuperordinateDomain(Ref.create(persistActiveDomain("example.tld")))
|
newHostResource(oldHostName())
|
||||||
.setInetAddresses(ImmutableSet.of(InetAddress.getLocalHost()))
|
.asBuilder()
|
||||||
.build());
|
.setSuperordinateDomain(Ref.create(persistActiveDomain("example.tld")))
|
||||||
|
.setInetAddresses(ImmutableSet.of(InetAddresses.forString("127.0.0.1")))
|
||||||
|
.build());
|
||||||
thrown.expect(RenameHostToExternalRemoveIpException.class);
|
thrown.expect(RenameHostToExternalRemoveIpException.class);
|
||||||
runFlow();
|
runFlow();
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ import static google.registry.testing.DatastoreHelper.persistResource;
|
||||||
import static google.registry.testing.HostResourceSubject.assertAboutHosts;
|
import static google.registry.testing.HostResourceSubject.assertAboutHosts;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
import com.google.common.net.InetAddresses;
|
||||||
import com.googlecode.objectify.Key;
|
import com.googlecode.objectify.Key;
|
||||||
import com.googlecode.objectify.Ref;
|
import com.googlecode.objectify.Ref;
|
||||||
import google.registry.model.EntityTestCase;
|
import google.registry.model.EntityTestCase;
|
||||||
|
@ -71,19 +72,20 @@ public class HostResourceTest extends EntityTestCase {
|
||||||
.setTransferRequestTrid(Trid.create("client trid"))
|
.setTransferRequestTrid(Trid.create("client trid"))
|
||||||
.build())
|
.build())
|
||||||
.build());
|
.build());
|
||||||
hostResource = cloneAndSetAutoTimestamps(
|
hostResource =
|
||||||
new HostResource.Builder()
|
cloneAndSetAutoTimestamps(
|
||||||
.setRepoId("DEADBEEF-COM")
|
new HostResource.Builder()
|
||||||
.setFullyQualifiedHostName("ns1.example.com")
|
.setRepoId("DEADBEEF-COM")
|
||||||
.setCreationClientId("a registrar")
|
.setFullyQualifiedHostName("ns1.example.com")
|
||||||
.setLastEppUpdateTime(clock.nowUtc())
|
.setCreationClientId("a registrar")
|
||||||
.setLastEppUpdateClientId("another registrar")
|
.setLastEppUpdateTime(clock.nowUtc())
|
||||||
.setLastTransferTime(clock.nowUtc())
|
.setLastEppUpdateClientId("another registrar")
|
||||||
.setInetAddresses(ImmutableSet.of(InetAddress.getLocalHost()))
|
.setLastTransferTime(clock.nowUtc())
|
||||||
.setStatusValues(ImmutableSet.of(StatusValue.OK))
|
.setInetAddresses(ImmutableSet.of(InetAddresses.forString("127.0.0.1")))
|
||||||
.setSuperordinateDomain(Ref.create(
|
.setStatusValues(ImmutableSet.of(StatusValue.OK))
|
||||||
loadByUniqueId(DomainResource.class, "example.com", clock.nowUtc())))
|
.setSuperordinateDomain(
|
||||||
.build());
|
Ref.create(loadByUniqueId(DomainResource.class, "example.com", clock.nowUtc())))
|
||||||
|
.build());
|
||||||
persistResource(hostResource);
|
persistResource(hostResource);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,9 +141,12 @@ public class HostResourceTest extends EntityTestCase {
|
||||||
assertThat(new HostResource.Builder()
|
assertThat(new HostResource.Builder()
|
||||||
.setInetAddresses(ImmutableSet.<InetAddress>of()).build().inetAddresses)
|
.setInetAddresses(ImmutableSet.<InetAddress>of()).build().inetAddresses)
|
||||||
.isNull();
|
.isNull();
|
||||||
assertThat(new HostResource.Builder()
|
assertThat(
|
||||||
.setInetAddresses(ImmutableSet.of(InetAddress.getLocalHost())).build().inetAddresses)
|
new HostResource.Builder()
|
||||||
.isNotNull();
|
.setInetAddresses(ImmutableSet.of(InetAddresses.forString("127.0.0.1")))
|
||||||
|
.build()
|
||||||
|
.inetAddresses)
|
||||||
|
.isNotNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue