Increase idle connection timeout
On slower devices the database connection could be closed by the time
the check is run. Increase the timeout to prevent flakiness.
Bug: 110478179
Test: SQLiteDatabaseTest.testCloseIdleConnection
Change-Id: I9fd403d24182cf1a2c6e2885ac55f1bbc9be83a2
diff --git a/tests/tests/database/src/android/database/sqlite/cts/SQLiteDatabaseTest.java b/tests/tests/database/src/android/database/sqlite/cts/SQLiteDatabaseTest.java
index 1dcee00..15b20d6 100644
--- a/tests/tests/database/src/android/database/sqlite/cts/SQLiteDatabaseTest.java
+++ b/tests/tests/database/src/android/database/sqlite/cts/SQLiteDatabaseTest.java
@@ -1565,7 +1565,7 @@
public void testCloseIdleConnection() throws Exception {
mDatabase.close();
SQLiteDatabase.OpenParams params = new SQLiteDatabase.OpenParams.Builder()
- .setIdleConnectionTimeout(1000).build();
+ .setIdleConnectionTimeout(5000).build();
mDatabase = SQLiteDatabase.openDatabase(mDatabaseFile, params);
// Wait a bit and check that connection is still open
Thread.sleep(600);
@@ -1574,9 +1574,9 @@
output.contains("Connection #0:"));
// Now cause idle timeout and check that connection is closed
- // We wait up to 5 seconds, which is longer than required 1 s to accommodate for delays in
+ // We wait up to 10 seconds, which is longer than required 1 s to accommodate for delays in
// message processing when system is busy
- boolean connectionWasClosed = waitForConnectionToClose(10, 500);
+ boolean connectionWasClosed = waitForConnectionToClose(20, 500);
assertTrue("Connection #0 should be closed", connectionWasClosed);
}