Extend timeout for requesting tethered interface

Extend the timeout to lower the EthernetTetheringTest flaky.

Besides, also explicitly exempt entitlement check in
EtetherntTetheringTest because it do not test tethering upstream
currently. Thus, the tests would not be interrupted by entitlement
check if test SIM is entitlement required.

Bug: 156713866
Test: TetheringCoverageTests, CtsTehteringTest

Change-Id: I45e8e8d737486def9d0de8943ec7f09ca0942a0b
This commit is contained in:
markchien
2020-05-28 11:04:46 +08:00
parent 6d0a178a6b
commit 908518d8e2

View File

@@ -76,7 +76,7 @@ import java.util.concurrent.TimeoutException;
public class EthernetTetheringTest { public class EthernetTetheringTest {
private static final String TAG = EthernetTetheringTest.class.getSimpleName(); private static final String TAG = EthernetTetheringTest.class.getSimpleName();
private static final int TIMEOUT_MS = 1000; private static final int TIMEOUT_MS = 5000;
private static final int PACKET_READ_TIMEOUT_MS = 100; private static final int PACKET_READ_TIMEOUT_MS = 100;
private static final int DHCP_DISCOVER_ATTEMPTS = 10; private static final int DHCP_DISCOVER_ATTEMPTS = 10;
private static final byte[] DHCP_REQUESTED_PARAMS = new byte[] { private static final byte[] DHCP_REQUESTED_PARAMS = new byte[] {
@@ -338,7 +338,8 @@ public class EthernetTetheringTest {
private MyTetheringEventCallback enableEthernetTethering(String iface) throws Exception { private MyTetheringEventCallback enableEthernetTethering(String iface) throws Exception {
return enableEthernetTethering(iface, return enableEthernetTethering(iface,
new TetheringRequest.Builder(TETHERING_ETHERNET).build()); new TetheringRequest.Builder(TETHERING_ETHERNET)
.setExemptFromEntitlementCheck(true).build());
} }
private int getMTU(TestNetworkInterface iface) throws SocketException { private int getMTU(TestNetworkInterface iface) throws SocketException {
@@ -508,7 +509,8 @@ public class EthernetTetheringTest {
LinkAddress localAddr = local == null ? null : new LinkAddress(local); LinkAddress localAddr = local == null ? null : new LinkAddress(local);
LinkAddress clientAddr = client == null ? null : new LinkAddress(client); LinkAddress clientAddr = client == null ? null : new LinkAddress(client);
return new TetheringRequest.Builder(TETHERING_ETHERNET) return new TetheringRequest.Builder(TETHERING_ETHERNET)
.setStaticIpv4Addresses(localAddr, clientAddr).build(); .setStaticIpv4Addresses(localAddr, clientAddr)
.setExemptFromEntitlementCheck(true).build();
} }
private void assertInvalidStaticIpv4Request(String iface, String local, String client) private void assertInvalidStaticIpv4Request(String iface, String local, String client)