You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by al...@apache.org on 2019/10/17 20:49:19 UTC

[kudu] branch branch-1.11.x updated (16bdf47 -> 0afd48c)

This is an automated email from the ASF dual-hosted git repository.

alexey pushed a change to branch branch-1.11.x
in repository https://gitbox.apache.org/repos/asf/kudu.git.


    from 16bdf47  master: GetTableStatistics should use signed ints
     new 65ff349  webserver-test: refactoring and simplification
     new 5e3e82b  master: fix the value of table metric 'live_row_count'
     new 0afd48c  kudu-tool-test: deflake TestFsAddRemoveDataDirEndToEnd

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/kudu/fs/data_dirs.cc           |  17 +++++--
 src/kudu/master/catalog_manager.cc |   7 ++-
 src/kudu/master/table_metrics.cc   |   3 +-
 src/kudu/server/webserver-test.cc  | 101 ++++++++++++++-----------------------
 src/kudu/tools/kudu-tool-test.cc   |   6 +++
 5 files changed, 66 insertions(+), 68 deletions(-)


[kudu] 03/03: kudu-tool-test: deflake TestFsAddRemoveDataDirEndToEnd

Posted by al...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

alexey pushed a commit to branch branch-1.11.x
in repository https://gitbox.apache.org/repos/asf/kudu.git

commit 0afd48c1d602fc83b91890d3fb3c8c7aca3d45f9
Author: Adar Dembo <ad...@cloudera.com>
AuthorDate: Wed Oct 16 12:15:56 2019 -0700

    kudu-tool-test: deflake TestFsAddRemoveDataDirEndToEnd
    
    This test was made somewhat flaky by KUDU-2901. The reason is subtle: if any
    unrelated IO (such as from a concurrently running test) interleaves with the
    creation of the second table, it's possible for the new data directory to be
    measured with less available space than the existing ones. The existing LBM
    containers have all been preallocated by this point so the test never
    remeasures available space. Thus, when the second table flushes, the
    KUDU-2901 heuristic ensures that all new data blocks land on the existing
    data directories rather than the new one.
    
    The fix is simple: a feature flag for this feature (which we should have had
    anyway), which we disable for the test.
    
    Change-Id: Ifb92759318c12d791d26eb8fb6b77914c284f4cb
    Reviewed-on: http://gerrit.cloudera.org:8080/14462
    Reviewed-by: Andrew Wong <aw...@cloudera.com>
    Tested-by: Adar Dembo <ad...@cloudera.com>
    (cherry picked from commit 7e8f37f8ddf46b965b0af4eba3f31c02b11b8fba)
    Reviewed-on: http://gerrit.cloudera.org:8080/14469
    Tested-by: Kudu Jenkins
    Reviewed-by: Grant Henke <gr...@apache.org>
---
 src/kudu/fs/data_dirs.cc         | 17 +++++++++++++----
 src/kudu/tools/kudu-tool-test.cc |  6 ++++++
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/src/kudu/fs/data_dirs.cc b/src/kudu/fs/data_dirs.cc
index c5205ab..5812e1d 100644
--- a/src/kudu/fs/data_dirs.cc
+++ b/src/kudu/fs/data_dirs.cc
@@ -95,6 +95,12 @@ DEFINE_bool(fs_lock_data_dirs, true,
 TAG_FLAG(fs_lock_data_dirs, unsafe);
 TAG_FLAG(fs_lock_data_dirs, evolving);
 
+DEFINE_bool(fs_data_dirs_consider_available_space, true,
+            "Whether to consider available space when selecting a data "
+            "directory during tablet or data block creation.");
+TAG_FLAG(fs_data_dirs_consider_available_space, runtime);
+TAG_FLAG(fs_data_dirs_consider_available_space, evolving);
+
 METRIC_DEFINE_gauge_uint64(server, data_dirs_failed,
                            "Data Directories Failed",
                            kudu::MetricUnit::kDataDirectories,
@@ -1011,9 +1017,11 @@ Status DataDirManager::GetDirForBlock(const CreateBlockOptions& opts, DataDir**
     return Status::OK();
   }
   // Pick two randomly and select the one with more space.
-  shuffle(candidate_dirs.begin(), candidate_dirs.end(), default_random_engine(rng_.Next()));
-  *dir = (candidate_dirs[0]->available_bytes() > candidate_dirs[1]->available_bytes()) ?
-          candidate_dirs[0] : candidate_dirs[1];
+  shuffle(candidate_dirs.begin(), candidate_dirs.end(),
+          default_random_engine(rng_.Next()));
+  *dir = PREDICT_TRUE(FLAGS_fs_data_dirs_consider_available_space) &&
+         candidate_dirs[0]->available_bytes() > candidate_dirs[1]->available_bytes() ?
+           candidate_dirs[0] : candidate_dirs[1];
   return Status::OK();
 }
 
@@ -1130,7 +1138,8 @@ void DataDirManager::GetDirsForGroupUnlocked(int target_size,
       int tablets_in_first = FindOrDie(tablets_by_uuid_idx_map_, candidate_indices[0]).size();
       int tablets_in_second = FindOrDie(tablets_by_uuid_idx_map_, candidate_indices[1]).size();
       int selected_index = 0;
-      if (tablets_in_first == tablets_in_second) {
+      if (tablets_in_first == tablets_in_second &&
+          PREDICT_TRUE(FLAGS_fs_data_dirs_consider_available_space)) {
         int64_t space_in_first = FindOrDie(data_dir_by_uuid_idx_,
                                            candidate_indices[0])->available_bytes();
         int64_t space_in_second = FindOrDie(data_dir_by_uuid_idx_,
diff --git a/src/kudu/tools/kudu-tool-test.cc b/src/kudu/tools/kudu-tool-test.cc
index d2c1718..f122e78 100644
--- a/src/kudu/tools/kudu-tool-test.cc
+++ b/src/kudu/tools/kudu-tool-test.cc
@@ -136,6 +136,7 @@
 #include "kudu/util/test_util.h"
 #include "kudu/util/url-coding.h"
 
+DECLARE_bool(fs_data_dirs_consider_available_space);
 DECLARE_bool(hive_metastore_sasl_enabled);
 DECLARE_bool(show_values);
 DECLARE_bool(show_attributes);
@@ -4943,6 +4944,11 @@ TEST_F(ToolTest, TestFsAddRemoveDataDirEndToEnd) {
     return;
   }
 
+  // Disable the available space heuristic as it can interfere with the desired
+  // test invariant below (that the newly created table write to the newly added
+  // data directory).
+  FLAGS_fs_data_dirs_consider_available_space = false;
+
   // Start a cluster whose tserver has multiple data directories.
   InternalMiniClusterOptions opts;
   opts.num_data_dirs = 2;


[kudu] 02/03: master: fix the value of table metric 'live_row_count'

Posted by al...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

alexey pushed a commit to branch branch-1.11.x
in repository https://gitbox.apache.org/repos/asf/kudu.git

commit 5e3e82b3a9b653dd24d4ec856cf4aaf66882cd17
Author: zhangyifan27 <ch...@163.com>
AuthorDate: Tue Oct 15 19:21:38 2019 +0800

    master: fix the value of table metric 'live_row_count'
    
    When the tablet doesn't support live row counting, the
    'live_row_count' metric of the tablet is '-1'. But when
    master aggregates all tablets' metric of a table, it sums
    up all '-1's, and the result value is confusing to users.
    It's better to set it '-1' to be consistent with tablet metric.
    
    Change-Id: I3f837466a0420dafef4f9426929b7b1622702ffc
    Reviewed-on: http://gerrit.cloudera.org:8080/14446
    Tested-by: Kudu Jenkins
    Reviewed-by: Yingchun Lai <40...@qq.com>
    Reviewed-by: Alexey Serbin <as...@cloudera.com>
    (cherry picked from commit d525c11d441143eeb40389ab920f5f651ddff54f)
    Reviewed-on: http://gerrit.cloudera.org:8080/14468
    Tested-by: Alexey Serbin <as...@cloudera.com>
    Reviewed-by: Grant Henke <gr...@apache.org>
---
 src/kudu/master/catalog_manager.cc | 7 ++++++-
 src/kudu/master/table_metrics.cc   | 3 ++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/kudu/master/catalog_manager.cc b/src/kudu/master/catalog_manager.cc
index 6108981..411906c 100644
--- a/src/kudu/master/catalog_manager.cc
+++ b/src/kudu/master/catalog_manager.cc
@@ -5573,7 +5573,12 @@ void TableInfo::UpdateMetrics(const tablet::ReportedTabletStatsPB& old_stats,
                               const tablet::ReportedTabletStatsPB& new_stats) {
   if (metrics_) {
     metrics_->on_disk_size->IncrementBy(new_stats.on_disk_size() - old_stats.on_disk_size());
-    metrics_->live_row_count->IncrementBy(new_stats.live_row_count() - old_stats.live_row_count());
+    if (new_stats.live_row_count() >= 0) {
+      metrics_->live_row_count->IncrementBy(
+          new_stats.live_row_count() - old_stats.live_row_count());
+    } else {
+      metrics_->live_row_count->set_value(-1);
+    }
   }
 }
 
diff --git a/src/kudu/master/table_metrics.cc b/src/kudu/master/table_metrics.cc
index 079379a..b259034 100644
--- a/src/kudu/master/table_metrics.cc
+++ b/src/kudu/master/table_metrics.cc
@@ -27,7 +27,8 @@ METRIC_DEFINE_gauge_int64(table, on_disk_size, "Table Size On Disk",
     "including metadata.");
 METRIC_DEFINE_gauge_int64(table, live_row_count, "Table Live Row count",
     kudu::MetricUnit::kRows,
-    "Pre-replication aggregated number of live rows in this table.");
+    "Pre-replication aggregated number of live rows in this table. "
+    "When the table doesn't support live row counting, -1 will be returned.");
 
 #define GINIT(x) x(METRIC_##x.Instantiate(entity, 0))
 


[kudu] 01/03: webserver-test: refactoring and simplification

Posted by al...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

alexey pushed a commit to branch branch-1.11.x
in repository https://gitbox.apache.org/repos/asf/kudu.git

commit 65ff3492cfd2febc5ab37bff06494d144f03a47a
Author: Adar Dembo <ad...@cloudera.com>
AuthorDate: Mon Oct 14 18:12:13 2019 -0700

    webserver-test: refactoring and simplification
    
    Change-Id: I1ba2e1bcc177b7f209562dd6e9c80043ebb9099d
    Reviewed-on: http://gerrit.cloudera.org:8080/14438
    Reviewed-by: Alexey Serbin <as...@cloudera.com>
    Tested-by: Kudu Jenkins
    (cherry picked from commit 6a0826ae38c86d9075fb4b5f61c4cecf4f1af681)
    Reviewed-on: http://gerrit.cloudera.org:8080/14466
    Reviewed-by: Grant Henke <gr...@apache.org>
---
 src/kudu/server/webserver-test.cc | 101 +++++++++++++++-----------------------
 1 file changed, 39 insertions(+), 62 deletions(-)

diff --git a/src/kudu/server/webserver-test.cc b/src/kudu/server/webserver-test.cc
index 2581ed0..cb6253f 100644
--- a/src/kudu/server/webserver-test.cc
+++ b/src/kudu/server/webserver-test.cc
@@ -55,6 +55,7 @@
 using std::string;
 using std::vector;
 using std::unique_ptr;
+using strings::Substitute;
 
 DECLARE_int32(webserver_max_post_length_bytes);
 
@@ -70,7 +71,7 @@ void SetSslOptions(WebserverOptions* opts) {
                                                        &opts->certificate_file,
                                                        &opts->private_key_file,
                                                        &password));
-  opts->private_key_password_cmd = strings::Substitute("echo $0", password);
+  opts->private_key_password_cmd = Substitute("echo $0", password);
 }
 
 void SetHTPasswdOptions(WebserverOptions* opts) {
@@ -106,6 +107,7 @@ class WebserverTest : public KuduTest {
     ASSERT_EQ(addrs.size(), 1);
     ASSERT_TRUE(addrs[0].IsWildcard());
     ASSERT_OK(addr_.ParseString("127.0.0.1", addrs[0].port()));
+    url_ = Substitute("http://$0", addr_.ToString());
   }
 
  protected:
@@ -119,7 +121,7 @@ class WebserverTest : public KuduTest {
   faststring buf_;
   unique_ptr<Webserver> server_;
   Sockaddr addr_;
-
+  string url_;
   string static_dir_;
 };
 
@@ -136,14 +138,13 @@ class PasswdWebserverTest : public WebserverTest {
 // Send a HTTP request with no username and password. It should reject
 // the request as the .htpasswd is presented to webserver.
 TEST_F(PasswdWebserverTest, TestPasswdMissing) {
-  Status status = curl_.FetchURL(strings::Substitute("http://$0/", addr_.ToString()),
-                                 &buf_);
+  Status status = curl_.FetchURL(url_, &buf_);
   ASSERT_EQ("Remote error: HTTP 401", status.ToString());
 }
 
 TEST_F(PasswdWebserverTest, TestPasswdPresent) {
-  string auth_url = strings::Substitute("http://$0@$1/", security::kTestAuthString,
-                                        addr_.ToString());
+  string auth_url = Substitute("http://$0@$1/", security::kTestAuthString,
+                               addr_.ToString());
   ASSERT_OK(curl_.FetchURL(auth_url, &buf_));
 }
 
@@ -166,12 +167,11 @@ class SpnegoWebserverTest : public WebserverTest {
   }
 
   Status DoSpnegoCurl() {
-    EasyCurl c;
-    c.set_use_spnego(true);
+    curl_.set_use_spnego(true);
     if (VLOG_IS_ON(1)) {
-      c.set_verbose(true);
+      curl_.set_verbose(true);
     }
-    return c.FetchURL(strings::Substitute("http://$0/", addr_.ToString()), &buf_);
+    return curl_.FetchURL(url_, &buf_);
   }
 
   unique_ptr<MiniKdc> kdc_;
@@ -224,12 +224,10 @@ TEST_F(SpnegoWebserverTest, TestUnauthenticatedNoClientAuth) {
 
 // Test some malformed authorization headers.
 TEST_F(SpnegoWebserverTest, TestInvalidHeaders) {
-  const string& url = strings::Substitute("http://$0/", addr_.ToString());
-  EasyCurl c;
-  EXPECT_EQ(c.FetchURL(url, &buf_, { "Authorization: blahblah" }).ToString(),
+  EXPECT_EQ(curl_.FetchURL(url_, &buf_, { "Authorization: blahblah" }).ToString(),
             "Remote error: HTTP 500");
   EXPECT_STR_CONTAINS(buf_.ToString(), "bad Negotiate header");
-  EXPECT_EQ(c.FetchURL(url, &buf_, { "Authorization: Negotiate aaa" }).ToString(),
+  EXPECT_EQ(curl_.FetchURL(url_, &buf_, { "Authorization: Negotiate aaa" }).ToString(),
             "Remote error: HTTP 401");
   EXPECT_STR_CONTAINS(buf_.ToString(), "Invalid token was supplied");
 }
@@ -237,11 +235,8 @@ TEST_F(SpnegoWebserverTest, TestInvalidHeaders) {
 // Test that if no authorization header at all is provided, the response
 // contains an empty "WWW-Authenticate: Negotiate" header.
 TEST_F(SpnegoWebserverTest, TestNoAuthHeader) {
-  const string& url = strings::Substitute("http://$0/", addr_.ToString());
-  EasyCurl c;
-  c.set_return_headers(true);
-  ASSERT_EQ(c.FetchURL(url, &buf_).ToString(),
-            "Remote error: HTTP 401");
+  curl_.set_return_headers(true);
+  ASSERT_EQ(curl_.FetchURL(url_, &buf_).ToString(), "Remote error: HTTP 401");
   ASSERT_STR_CONTAINS(buf_.ToString(), "WWW-Authenticate: Negotiate\r\n");
 }
 
@@ -253,8 +248,6 @@ TEST_F(SpnegoWebserverTest, TestNoAuthHeader) {
 // from some previous run of SPNEGO on a different KDC. This test is primarily concerned
 // with defending against remote buffer overflows during token parsing, etc.
 TEST_F(SpnegoWebserverTest, TestBitFlippedTokens) {
-  const string& url = strings::Substitute("http://$0/", addr_.ToString());
-  EasyCurl c;
   string token;
   CHECK(strings::Base64Unescape(kWellFormedTokenBase64, &token));
 
@@ -265,8 +258,8 @@ TEST_F(SpnegoWebserverTest, TestBitFlippedTokens) {
       token[i] ^= 1 << bit;
       string b64_token;
       strings::Base64Escape(token, &b64_token);
-      string header = strings::Substitute("Authorization: Negotiate $0", b64_token);
-      Status s = c.FetchURL(url, &buf_, { header });
+      string header = Substitute("Authorization: Negotiate $0", b64_token);
+      Status s = curl_.FetchURL(url_, &buf_, { header });
       EXPECT_TRUE(s.IsRemoteError()) << s.ToString();
       token[i] ^= 1 << bit;
     }
@@ -278,8 +271,6 @@ TEST_F(SpnegoWebserverTest, TestBitFlippedTokens) {
 //
 // NOTE: see above regarding "well-formed" vs "valid".
 TEST_F(SpnegoWebserverTest, TestTruncatedTokens) {
-  const string& url = strings::Substitute("http://$0/", addr_.ToString());
-  EasyCurl c;
   string token;
   CHECK(strings::Base64Unescape(kWellFormedTokenBase64, &token));
 
@@ -288,16 +279,15 @@ TEST_F(SpnegoWebserverTest, TestTruncatedTokens) {
     SCOPED_TRACE(token.size());
     string b64_token;
     strings::Base64Escape(token, &b64_token);
-    string header = strings::Substitute("Authorization: Negotiate $0", b64_token);
-    Status s = c.FetchURL(url, &buf_, { header });
+    string header = Substitute("Authorization: Negotiate $0", b64_token);
+    Status s = curl_.FetchURL(url_, &buf_, { header });
     EXPECT_TRUE(s.IsRemoteError()) << s.ToString();
   } while (!token.empty());
 }
 
 TEST_F(WebserverTest, TestIndexPage) {
   curl_.set_return_headers(true);
-  ASSERT_OK(curl_.FetchURL(strings::Substitute("http://$0/", addr_.ToString()),
-                           &buf_));
+  ASSERT_OK(curl_.FetchURL(url_, &buf_));
   // Check expected header.
   ASSERT_STR_CONTAINS(buf_.ToString(), "X-Frame-Options: DENY");
 
@@ -309,12 +299,11 @@ TEST_F(WebserverTest, TestIndexPage) {
 }
 
 TEST_F(WebserverTest, TestHttpCompression) {
-  string url = strings::Substitute("http://$0/", addr_.ToString());
   std::ostringstream oss;
   string decoded_str;
 
   // Curl with gzip compression enabled.
-  ASSERT_OK(curl_.FetchURL(url, &buf_, {"Accept-Encoding: deflate, br, gzip"}));
+  ASSERT_OK(curl_.FetchURL(url_, &buf_, {"Accept-Encoding: deflate, br, gzip"}));
 
   // If compressed successfully, we should be able to uncompress.
   ASSERT_OK(zlib::Uncompress(Slice(buf_.ToString()), &oss));
@@ -328,14 +317,14 @@ TEST_F(WebserverTest, TestHttpCompression) {
 
   // Should have expected header when compressed with headers returned.
   curl_.set_return_headers(true);
-  ASSERT_OK(curl_.FetchURL(url, &buf_,
+  ASSERT_OK(curl_.FetchURL(url_, &buf_,
                           {"Accept-Encoding: deflate, megaturbogzip,  gzip , br"}));
   ASSERT_STR_CONTAINS(buf_.ToString(), "Content-Encoding: gzip");
 
 
   // Curl with compression disabled.
   curl_.set_return_headers(true);
-  ASSERT_OK(curl_.FetchURL(url, &buf_));
+  ASSERT_OK(curl_.FetchURL(url_, &buf_));
   // Check expected header.
   ASSERT_STR_CONTAINS(buf_.ToString(), "Content-Type:");
 
@@ -351,7 +340,7 @@ TEST_F(WebserverTest, TestHttpCompression) {
 
   // Curl with compression enabled but not accepted by Kudu.
   curl_.set_return_headers(true);
-  ASSERT_OK(curl_.FetchURL(url, &buf_, {"Accept-Encoding: megaturbogzip, deflate, xz"}));
+  ASSERT_OK(curl_.FetchURL(url_, &buf_, {"Accept-Encoding: megaturbogzip, deflate, xz"}));
   // Check expected header.
   ASSERT_STR_CONTAINS(buf_.ToString(), "HTTP/1.1 200 OK");
 
@@ -369,16 +358,14 @@ TEST_F(SslWebserverTest, TestSSL) {
   // We use a self-signed cert, so we need to disable cert verification in curl.
   curl_.set_verify_peer(false);
 
-  ASSERT_OK(curl_.FetchURL(strings::Substitute("https://$0/", addr_.ToString()),
-                           &buf_));
+  ASSERT_OK(curl_.FetchURL(Substitute("https://$0/", addr_.ToString()), &buf_));
   // Should have expected title.
   ASSERT_STR_CONTAINS(buf_.ToString(), "Kudu");
 }
 
 TEST_F(WebserverTest, TestDefaultPaths) {
   // Test memz
-  ASSERT_OK(curl_.FetchURL(strings::Substitute("http://$0/memz?raw=1", addr_.ToString()),
-                           &buf_));
+  ASSERT_OK(curl_.FetchURL(Substitute("$0/memz?raw=1", url_), &buf_));
 #ifdef TCMALLOC_ENABLED
   ASSERT_STR_CONTAINS(buf_.ToString(), "Bytes in use by application");
 #else
@@ -386,23 +373,20 @@ TEST_F(WebserverTest, TestDefaultPaths) {
 #endif
 
   // Test varz -- check for one of the built-in gflags flags.
-  ASSERT_OK(curl_.FetchURL(strings::Substitute("http://$0/varz?raw=1", addr_.ToString()),
-                           &buf_));
+  ASSERT_OK(curl_.FetchURL(Substitute("$0/varz?raw=1", url_), &buf_));
   ASSERT_STR_CONTAINS(buf_.ToString(), "--v=");
 }
 
 TEST_F(WebserverTest, TestRedactFlagsDump) {
   kudu::g_should_redact = kudu::RedactContext::ALL;
   // Test varz -- check for the sensitive flag is redacted and HTML-escaped.
-  ASSERT_OK(curl_.FetchURL(strings::Substitute("http://$0/varz", addr_.ToString()),
-                           &buf_));
+  ASSERT_OK(curl_.FetchURL(Substitute("$0/varz", url_), &buf_));
   ASSERT_STR_CONTAINS(buf_.ToString(), "--test_sensitive_flag=&lt;redacted&gt;");
 
   // Test varz?raw -- check for the sensitive flag is redacted and not HTML-escaped.
-  ASSERT_OK(curl_.FetchURL(strings::Substitute("http://$0/varz?raw=1", addr_.ToString()),
-                           &buf_));
-  ASSERT_STR_CONTAINS(buf_.ToString(), strings::Substitute("--test_sensitive_flag=$0",
-                                                           kRedactionMessage));
+  ASSERT_OK(curl_.FetchURL(Substitute("$0/varz?raw=1", url_), &buf_));
+  ASSERT_STR_CONTAINS(buf_.ToString(), Substitute("--test_sensitive_flag=$0",
+                                                  kRedactionMessage));
 }
 
 // Used in symbolization test below.
@@ -412,15 +396,13 @@ void SomeMethodForSymbolTest2() {}
 
 TEST_F(WebserverTest, TestPprofPaths) {
   // Test /pprof/cmdline GET
-  ASSERT_OK(curl_.FetchURL(strings::Substitute("http://$0/pprof/cmdline", addr_.ToString()),
-                           &buf_));
+  ASSERT_OK(curl_.FetchURL(Substitute("$0/pprof/cmdline", url_), &buf_));
   ASSERT_STR_CONTAINS(buf_.ToString(), "webserver-test");
   ASSERT_TRUE(!HasSuffixString(buf_.ToString(), string("\x00", 1)))
     << "should not have trailing NULL: " << Slice(buf_).ToDebugString();
 
   // Test /pprof/symbol GET
-  ASSERT_OK(curl_.FetchURL(strings::Substitute("http://$0/pprof/symbol", addr_.ToString()),
-                           &buf_));
+  ASSERT_OK(curl_.FetchURL(Substitute("$0/pprof/symbol", url_), &buf_));
   ASSERT_EQ(buf_.ToString(), "num_symbols: 1");
 
   // Test /pprof/symbol POST
@@ -430,8 +412,7 @@ TEST_F(WebserverTest, TestPprofPaths) {
                               &SomeMethodForSymbolTest1,
                               &SomeMethodForSymbolTest2);
     SCOPED_TRACE(req);
-    ASSERT_OK(curl_.PostToURL(strings::Substitute("http://$0/pprof/symbol", addr_.ToString()),
-                              req, &buf_));
+    ASSERT_OK(curl_.PostToURL(Substitute("$0/pprof/symbol", url_), req, &buf_));
     ASSERT_EQ(buf_.ToString(),
               StringPrintf("%p\tkudu::SomeMethodForSymbolTest1()\n"
                            "%p\tkudu::SomeMethodForSymbolTest2()\n",
@@ -445,8 +426,7 @@ TEST_F(WebserverTest, TestPprofPaths) {
 TEST_F(WebserverTest, TestPostTooBig) {
   FLAGS_webserver_max_post_length_bytes = 10;
   string req(10000, 'c');
-  Status s = curl_.PostToURL(strings::Substitute("http://$0/pprof/symbol", addr_.ToString()),
-                             req, &buf_);
+  Status s = curl_.PostToURL(Substitute("$0/pprof/symbol", url_), req, &buf_);
   ASSERT_EQ("Remote error: HTTP 413", s.ToString());
 }
 
@@ -454,21 +434,18 @@ TEST_F(WebserverTest, TestPostTooBig) {
 // disabled.
 TEST_F(WebserverTest, TestStaticFiles) {
   // Fetch a non-existent static file.
-  Status s = curl_.FetchURL(strings::Substitute("http://$0/foo.txt", addr_.ToString()),
-                            &buf_);
+  Status s = curl_.FetchURL(Substitute("$0/foo.txt", url_), &buf_);
   ASSERT_EQ("Remote error: HTTP 404", s.ToString());
 
   // Create the file and fetch again. This time it should succeed.
   ASSERT_OK(WriteStringToFile(env_, "hello world",
-                              strings::Substitute("$0/foo.txt", static_dir_)));
-  ASSERT_OK(curl_.FetchURL(strings::Substitute("http://$0/foo.txt", addr_.ToString()),
-                           &buf_));
+                              Substitute("$0/foo.txt", static_dir_)));
+  ASSERT_OK(curl_.FetchURL(Substitute("$0/foo.txt", url_), &buf_));
   ASSERT_EQ("hello world", buf_.ToString());
 
   // Create a directory and ensure that subdirectory listing is disabled.
-  ASSERT_OK(env_->CreateDir(strings::Substitute("$0/dir", static_dir_)));
-  s = curl_.FetchURL(strings::Substitute("http://$0/dir/", addr_.ToString()),
-                     &buf_);
+  ASSERT_OK(env_->CreateDir(Substitute("$0/dir", static_dir_)));
+  s = curl_.FetchURL(Substitute("$0/dir/", url_), &buf_);
   ASSERT_EQ("Remote error: HTTP 403", s.ToString());
 }