Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 57CDF200BAD for ; Tue, 11 Oct 2016 02:32:43 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 56064160AF6; Tue, 11 Oct 2016 00:32:43 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 9DAD1160AEB for ; Tue, 11 Oct 2016 02:32:42 +0200 (CEST) Received: (qmail 46595 invoked by uid 500); 11 Oct 2016 00:32:41 -0000 Mailing-List: contact commits-help@kudu.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@kudu.apache.org Delivered-To: mailing list commits@kudu.apache.org Received: (qmail 46570 invoked by uid 99); 11 Oct 2016 00:32:41 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Oct 2016 00:32:41 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 9B4CDDFD4C; Tue, 11 Oct 2016 00:32:41 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: danburkert@apache.org To: commits@kudu.apache.org Date: Tue, 11 Oct 2016 00:32:41 -0000 Message-Id: <3865b35e99fe4d6ead182d129a774dfe@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/3] kudu git commit: [flaky tests] Fix ClientTest.TestFailedDnsResolution archived-at: Tue, 11 Oct 2016 00:32:43 -0000 Repository: kudu Updated Branches: refs/heads/master ac519fde8 -> 64ec12149 [flaky tests] Fix ClientTest.TestFailedDnsResolution In this test we're testing that we get dns resolution error back when a dns resolution error fails. However there is a narrow window in which the returned error might be a master GetTabletLocations() RPC instead, because of KUDU-1466. This changes the test to retry until it gets the appropriate error. Change-Id: I9fa3ceb7215d60cd23efabf729731254524e1625 Reviewed-on: http://gerrit.cloudera.org:8080/4643 Reviewed-by: Alexey Serbin Tested-by: David Ribeiro Alves Project: http://git-wip-us.apache.org/repos/asf/kudu/repo Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/1956c9d8 Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/1956c9d8 Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/1956c9d8 Branch: refs/heads/master Commit: 1956c9d8739b8374a53fceb2a5753de6151bba31 Parents: ac519fd Author: David Alves Authored: Wed Oct 5 20:53:32 2016 -0700 Committer: David Ribeiro Alves Committed: Mon Oct 10 18:27:05 2016 +0000 ---------------------------------------------------------------------- src/kudu/client/client-test.cc | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kudu/blob/1956c9d8/src/kudu/client/client-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/client/client-test.cc b/src/kudu/client/client-test.cc index 8b8456b..2919280 100644 --- a/src/kudu/client/client-test.cc +++ b/src/kudu/client/client-test.cc @@ -1916,21 +1916,35 @@ TEST_F(ClientTest, TestWriteTimeout) { TEST_F(ClientTest, TestFailedDnsResolution) { shared_ptr session = client_->NewSession(); ASSERT_OK(session->SetFlushMode(KuduSession::MANUAL_FLUSH)); + const string kMasterError = "timed out after deadline expired: GetTableLocations RPC"; // First time disable dns resolution. // Set the timeout to be short since we know it can't succeed, but not to the point where we // can timeout before getting the dns error. { - google::FlagSaver saver; - FLAGS_fail_dns_resolution = true; - session->SetTimeoutMillis(500); - ASSERT_OK(ApplyInsertToSession(session.get(), client_table_, 1, 1, "row")); - Status s = session->Flush(); - ASSERT_TRUE(s.IsIOError()) << "unexpected status: " << s.ToString(); - gscoped_ptr error = GetSingleErrorFromSession(session.get()); - ASSERT_TRUE(error->status().IsTimedOut()) << error->status().ToString(); - ASSERT_STR_CONTAINS(error->status().ToString(), - "Network error: Failed to resolve address for TS"); + for (int i = 0;;i++) { + google::FlagSaver saver; + FLAGS_fail_dns_resolution = true; + session->SetTimeoutMillis(500); + ASSERT_OK(ApplyInsertToSession(session.get(), client_table_, 1, 1, "row")); + Status s = session->Flush(); + ASSERT_TRUE(s.IsIOError()) << "unexpected status: " << s.ToString(); + gscoped_ptr error = GetSingleErrorFromSession(session.get()); + ASSERT_TRUE(error->status().IsTimedOut()) << error->status().ToString(); + + // Due to KUDU-1466 there is a narrow window in which the error reported might be that the + // GetTableLocations RPC to the master timed out instead of the expected dns resolution error. + // In that case just loop again. + + if (error->status().ToString().find(kMasterError) != std::string::npos) { + ASSERT_LE(i, 10) << "Didn't get a dns resolution error after 10 tries."; + continue; + } + + ASSERT_STR_CONTAINS(error->status().ToString(), + "Network error: Failed to resolve address for TS"); + break; + } } // Now re-enable dns resolution, the write should succeed.