ashniku commented on code in PR #6412:
URL: https://github.com/apache/hive/pull/6412#discussion_r3044648052
##########
itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestJdbcDriver2.java:
##########
@@ -131,6 +132,33 @@ public class TestJdbcDriver2 {
@Rule public ExpectedException thrown = ExpectedException.none();
@Rule public final TestName testName = new TestName();
+ /**
+ * {@code SET hive.query.timeout.seconds} applies to the whole HS2 session.
Tests such as
+ * {@link #testQueryTimeoutMessageUsesHiveConf()} must not leave a short
limit on the shared
+ * {@link #con}, or unrelated tests will see {@link SQLTimeoutException}.
+ */
+ @After
+ public void resetHiveSessionQueryTimeout() {
+ try {
+ if (con == null || con.isClosed()) {
+ return;
+ }
+ try (Statement st = con.createStatement()) {
+ st.execute("set hive.query.timeout.seconds=0s");
+ }
+ } catch (SQLException e) {
+ LOG.warn("Could not reset hive.query.timeout.seconds after {}",
testName.getMethodName(), e);
+ }
+ }
+
+ /**
+ * HS2 / {@code HiveStatement} report timeouts as {@code ...timed out after
N seconds...}; match
+ * {@code N == 1} with flexible whitespace so we do not treat {@code 10} or
unrelated digits as {@code 1}.
+ */
+ private static boolean isQueryTimedOutAfterOneSecondMessage(String msg) {
+ return msg != null && msg.matches("(?is).*timed out
after\\s+1\\s+seconds.*");
Review Comment:
Removed isQueryTimedOutAfterOneSecondMessage (regex helper).
Positive assertions use assertEquals("…", QUERY_TIMED_OUT_AFTER_1_SECONDS,
e.getMessage()) in both timeout-related tests.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]