This is an automated email from the ASF dual-hosted git repository. alexey pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/kudu.git
The following commit(s) were added to refs/heads/master by this push: new ebf0a645d [clock] fix HybridClockTest.TimeSourceAutoSelection ebf0a645d is described below commit ebf0a645d5deb4be40faf441e230be07016fb683 Author: Alexey Serbin <ale...@apache.org> AuthorDate: Mon Aug 7 12:41:00 2023 -0700 [clock] fix HybridClockTest.TimeSourceAutoSelection It was reported that HybridClockTest.TimeSourceAutoSelection scenario had failed with the following message: src/kudu/clock/hybrid_clock-test.cc:501: Failure Value of: s.ToString() Expected: has substring "Error reading clock. Clock considered unsynchronized" Actual: "Service unavailable: timed out waiting for clock synchronisation: wallclock is not synchronized: no valid NTP responses yet" (of type std::string) This patch addresses the issue, updating the pattern of the expected error message to account for the string output by the built-in NTP clock as well. Change-Id: Ie30ca383f50db1f62e140da5181e9a406367f7bd Reviewed-on: http://gerrit.cloudera.org:8080/20324 Tested-by: Alexey Serbin <ale...@apache.org> Reviewed-by: Mahesh Reddy <mre...@cloudera.com> Reviewed-by: Yifan Zhang <chinazhangyi...@163.com> --- src/kudu/clock/hybrid_clock-test.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/kudu/clock/hybrid_clock-test.cc b/src/kudu/clock/hybrid_clock-test.cc index f711c56c2..319834a4e 100644 --- a/src/kudu/clock/hybrid_clock-test.cc +++ b/src/kudu/clock/hybrid_clock-test.cc @@ -497,8 +497,15 @@ TEST_F(HybridClockTest, TimeSourceAutoSelection) { ASSERT_STR_CONTAINS(s.ToString(), "Operation not permitted"); preconditions_satisfied = false; } else if (s.IsServiceUnavailable()) { - ASSERT_STR_CONTAINS( - s.ToString(), "Error reading clock. Clock considered unsynchronized"); + // For the effective time source auto-selected, the pattern for the error + // message below covers the 'builtin' and the 'system' cases + // correspondingly. The only other possible case left is 'system_unsync': + // if the 'system_unsync' time source is auto-selected, there shouldn't be + // any clock synchronization error unless the --inject_unsync_time_errors + // flag is set to 'true', which isn't the case in this test scenario. + static const string kErrMsgPattern = "(wallclock is not synchronized|" + "Error reading clock\\. Clock considered unsynchronized)"; + ASSERT_STR_MATCHES(s.ToString(), kErrMsgPattern); preconditions_satisfied = false; } }