diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryLoggerIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryLoggerIT.java index 5769da066db..e3e695e5e21 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryLoggerIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryLoggerIT.java @@ -280,7 +280,9 @@ private void testPreparedStatement(LogLevel loglevel) throws Exception { props.setProperty(QueryServices.LOG_LEVEL, loglevel.name()); Connection conn = DriverManager.getConnection(getUrl(), props); assertEquals(conn.unwrap(PhoenixConnection.class).getLogLevel(), loglevel); - final MyClock clock = new MyClock(100); + // The fixed clock also drives the server clock. Start it at the current time, so server + // calls do not expire when the test resets the clock. + final MyClock clock = new MyClock(EnvironmentEdgeManager.currentTimeMillis()); EnvironmentEdgeManager.injectEdge(clock); try { String query = "SELECT * FROM " + tableName + " where V = ?"; @@ -323,7 +325,7 @@ private void testPreparedStatement(LogLevel loglevel) throws Exception { assertTrue(LogLevel.TRACE == loglevel ? rs.getString(SCAN_METRICS_JSON).contains("scanMetrics") : rs.getString(SCAN_METRICS_JSON) == null); - assertEquals(rs.getTimestamp(START_TIME).getTime(), 100); + assertEquals(clock.time, rs.getTimestamp(START_TIME).getTime()); assertEquals(rs.getString(TENANT_ID), null); } }