Merge "Cleanup of resource limit tests"
am: 7d0a38956e
Change-Id: Ifcbc61ad8003c43ba1baff6d4d534192f6498206
This commit is contained in:
@@ -270,8 +270,8 @@ public class IpSecServiceTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function checks if the number of encap UDP socket that one UID can reserve
|
* This function checks if the number of encap UDP socket that one UID can reserve has a
|
||||||
* has a reasonable limit.
|
* reasonable limit.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testSocketResourceTrackerLimitation() throws Exception {
|
public void testSocketResourceTrackerLimitation() throws Exception {
|
||||||
@@ -287,9 +287,10 @@ public class IpSecServiceTest {
|
|||||||
openUdpEncapSockets.add(newUdpEncapSocket);
|
openUdpEncapSockets.add(newUdpEncapSocket);
|
||||||
}
|
}
|
||||||
// Assert that the total sockets quota has a reasonable limit.
|
// Assert that the total sockets quota has a reasonable limit.
|
||||||
|
assertTrue("No UDP encap socket was open", !openUdpEncapSockets.isEmpty());
|
||||||
assertTrue(
|
assertTrue(
|
||||||
openUdpEncapSockets.size() > 0
|
"Number of open UDP encap sockets is out of bound",
|
||||||
&& openUdpEncapSockets.size() < MAX_NUM_ENCAP_SOCKETS);
|
openUdpEncapSockets.size() < MAX_NUM_ENCAP_SOCKETS);
|
||||||
|
|
||||||
// Try to reserve one more UDP encapsulation socket, and should fail.
|
// Try to reserve one more UDP encapsulation socket, and should fail.
|
||||||
IpSecUdpEncapResponse extraUdpEncapSocket =
|
IpSecUdpEncapResponse extraUdpEncapSocket =
|
||||||
@@ -297,7 +298,7 @@ public class IpSecServiceTest {
|
|||||||
assertNotNull(extraUdpEncapSocket);
|
assertNotNull(extraUdpEncapSocket);
|
||||||
assertEquals(IpSecManager.Status.RESOURCE_UNAVAILABLE, extraUdpEncapSocket.status);
|
assertEquals(IpSecManager.Status.RESOURCE_UNAVAILABLE, extraUdpEncapSocket.status);
|
||||||
|
|
||||||
// Close one of the open UDP encapsulation scokets.
|
// Close one of the open UDP encapsulation sockets.
|
||||||
mIpSecService.closeUdpEncapsulationSocket(openUdpEncapSockets.get(0).resourceId);
|
mIpSecService.closeUdpEncapsulationSocket(openUdpEncapSockets.get(0).resourceId);
|
||||||
openUdpEncapSockets.get(0).fileDescriptor.close();
|
openUdpEncapSockets.get(0).fileDescriptor.close();
|
||||||
openUdpEncapSockets.remove(0);
|
openUdpEncapSockets.remove(0);
|
||||||
@@ -316,10 +317,9 @@ public class IpSecServiceTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function checks if the number of SPI that one UID can reserve
|
* This function checks if the number of SPI that one UID can reserve has a reasonable limit.
|
||||||
* has a reasonable limit.
|
* This test does not test for both address families or duplicate SPIs because resource tracking
|
||||||
* This test does not test for both address families or duplicate SPIs because resource
|
* code does not depend on them.
|
||||||
* tracking code does not depend on them.
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testSpiResourceTrackerLimitation() throws Exception {
|
public void testSpiResourceTrackerLimitation() throws Exception {
|
||||||
|
|||||||
Reference in New Issue
Block a user