You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by an...@apache.org on 2018/01/12 17:32:45 UTC

[06/10] mesos git commit: Fixed conversion warnings in tests.

Fixed conversion warnings in tests.

Stringified a `size_t` for `http::Request.headers` value.

The types in `metrics_tests.cpp` were defined as `double`, and so should
be compared with `EXPECT_DOUBLE_EQ`, not `EXPECT_FLOAT_EQ`.

Review: https://reviews.apache.org/r/64733


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/65f06d36
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/65f06d36
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/65f06d36

Branch: refs/heads/master
Commit: 65f06d36ad1701e70f541f42b8a32961e471ff15
Parents: 67d4247
Author: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Authored: Tue Dec 12 16:16:29 2017 -0800
Committer: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Committed: Fri Jan 12 09:29:17 2018 -0800

----------------------------------------------------------------------
 3rdparty/libprocess/src/tests/http_tests.cpp    |  2 +-
 3rdparty/libprocess/src/tests/metrics_tests.cpp | 32 ++++++++++----------
 2 files changed, 17 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/65f06d36/3rdparty/libprocess/src/tests/http_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/http_tests.cpp b/3rdparty/libprocess/src/tests/http_tests.cpp
index 9daac71..f79d366 100644
--- a/3rdparty/libprocess/src/tests/http_tests.cpp
+++ b/3rdparty/libprocess/src/tests/http_tests.cpp
@@ -997,7 +997,7 @@ TEST(HTTPConnectionTest, GzipRequestBody)
   request.keepAlive = true;
 
   request.headers["Content-Encoding"] = "gzip";
-  request.headers["Content-Length"] = request.body.length();
+  request.headers["Content-Length"] = stringify(request.body.length());
 
   Future<http::Response> response = connection.send(request);
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/65f06d36/3rdparty/libprocess/src/tests/metrics_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/metrics_tests.cpp b/3rdparty/libprocess/src/tests/metrics_tests.cpp
index 5f7117e..5a5a2e5 100644
--- a/3rdparty/libprocess/src/tests/metrics_tests.cpp
+++ b/3rdparty/libprocess/src/tests/metrics_tests.cpp
@@ -192,15 +192,15 @@ TEST_F(MetricsTest, Statistics)
 
   EXPECT_EQ(11u, statistics.get().count);
 
-  EXPECT_FLOAT_EQ(0.0, statistics.get().min);
-  EXPECT_FLOAT_EQ(10.0, statistics.get().max);
+  EXPECT_DOUBLE_EQ(0.0, statistics.get().min);
+  EXPECT_DOUBLE_EQ(10.0, statistics.get().max);
 
-  EXPECT_FLOAT_EQ(5.0, statistics.get().p50);
-  EXPECT_FLOAT_EQ(9.0, statistics.get().p90);
-  EXPECT_FLOAT_EQ(9.5, statistics.get().p95);
-  EXPECT_FLOAT_EQ(9.9, statistics.get().p99);
-  EXPECT_FLOAT_EQ(9.99, statistics.get().p999);
-  EXPECT_FLOAT_EQ(9.999, statistics.get().p9999);
+  EXPECT_DOUBLE_EQ(5.0, statistics.get().p50);
+  EXPECT_DOUBLE_EQ(9.0, statistics.get().p90);
+  EXPECT_DOUBLE_EQ(9.5, statistics.get().p95);
+  EXPECT_DOUBLE_EQ(9.9, statistics.get().p99);
+  EXPECT_DOUBLE_EQ(9.99, statistics.get().p999);
+  EXPECT_DOUBLE_EQ(9.999, statistics.get().p9999);
 
   AWAIT_READY(metrics::remove(counter));
 }
@@ -242,13 +242,13 @@ TEST_F(MetricsTest, THREADSAFE_Snapshot)
   map<string, JSON::Value> values = responseJSON.get().values;
 
   EXPECT_EQ(1u, values.count("test/counter"));
-  EXPECT_FLOAT_EQ(0.0, values["test/counter"].as<JSON::Number>().as<double>());
+  EXPECT_DOUBLE_EQ(0.0, values["test/counter"].as<JSON::Number>().as<double>());
 
   EXPECT_EQ(1u, values.count("test/gauge"));
-  EXPECT_FLOAT_EQ(42.0, values["test/gauge"].as<JSON::Number>().as<double>());
+  EXPECT_DOUBLE_EQ(42.0, values["test/gauge"].as<JSON::Number>().as<double>());
 
   EXPECT_EQ(1u, values.count("test/gauge_const"));
-  EXPECT_FLOAT_EQ(
+  EXPECT_DOUBLE_EQ(
       99.0, values["test/gauge_const"].as<JSON::Number>().as<double>());
 
   EXPECT_EQ(0u, values.count("test/gauge_fail"));
@@ -397,10 +397,10 @@ TEST_F(MetricsTest, THREADSAFE_SnapshotTimeout)
   map<string, JSON::Value> values = responseJSON.get().values;
 
   EXPECT_EQ(1u, values.count("test/counter"));
-  EXPECT_FLOAT_EQ(0.0, values["test/counter"].as<JSON::Number>().as<double>());
+  EXPECT_DOUBLE_EQ(0.0, values["test/counter"].as<JSON::Number>().as<double>());
 
   EXPECT_EQ(1u, values.count("test/gauge"));
-  EXPECT_FLOAT_EQ(42.0, values["test/gauge"].as<JSON::Number>().as<double>());
+  EXPECT_DOUBLE_EQ(42.0, values["test/gauge"].as<JSON::Number>().as<double>());
 
   EXPECT_EQ(0u, values.count("test/gauge_fail"));
   EXPECT_EQ(0u, values.count("test/gauge_timeout"));
@@ -497,7 +497,7 @@ TEST_F(MetricsTest, SnapshotStatistics)
   // Ensure the expected keys are in the response and that the values match
   // expectations.
   foreachkey (const string& key, expected) {
-    EXPECT_FLOAT_EQ(expected[key], responseValues[key]);
+    EXPECT_DOUBLE_EQ(expected[key], responseValues[key]);
   }
 
   AWAIT_READY(metrics::remove(counter));
@@ -522,7 +522,7 @@ TEST_F(MetricsTest, Timer)
 
   Future<double> value = timer.value();
   AWAIT_READY(value);
-  EXPECT_FLOAT_EQ(value.get(), Microseconds(1).ns());
+  EXPECT_DOUBLE_EQ(value.get(), static_cast<double>(Microseconds(1).ns()));
 
   // It is not an error to stop a timer that has already been stopped.
   timer.stop();
@@ -558,7 +558,7 @@ TEST_F(MetricsTest, AsyncTimer)
 
   // The future should have taken zero time.
   AWAIT_READY(t.value());
-  EXPECT_FLOAT_EQ(t.value().get(), 0.0);
+  EXPECT_DOUBLE_EQ(t.value().get(), 0.0);
 
   AWAIT_READY(metrics::remove(t));
 }