You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2018/01/09 02:34:16 UTC

[1/3] mesos git commit: Reverted back to alphabetical ordering of libprocess metrics in JSON.

Repository: mesos
Updated Branches:
  refs/heads/master a9a49f834 -> e989b2266


Reverted back to alphabetical ordering of libprocess metrics in JSON.

At some point, the alphabetical ordering of metrics in the JSON
response was lost. This doesn't matter for consumption within a
program, but this loses readability for human users hitting the
metrics via a browser or curl.

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


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

Branch: refs/heads/master
Commit: 3d5bf3fb66f4a55edba47849aa3d1998fb64e943
Parents: a9a49f8
Author: Benjamin Mahler <bm...@apache.org>
Authored: Sat Jan 6 19:28:35 2018 -0800
Committer: Benjamin Mahler <bm...@apache.org>
Committed: Mon Jan 8 17:41:02 2018 -0800

----------------------------------------------------------------------
 3rdparty/libprocess/include/process/metrics/metrics.hpp |  7 ++++---
 3rdparty/libprocess/src/metrics/metrics.cpp             | 10 ++++++----
 2 files changed, 10 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/3d5bf3fb/3rdparty/libprocess/include/process/metrics/metrics.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/metrics/metrics.hpp b/3rdparty/libprocess/include/process/metrics/metrics.hpp
index 9c32a88..35633c7 100644
--- a/3rdparty/libprocess/include/process/metrics/metrics.hpp
+++ b/3rdparty/libprocess/include/process/metrics/metrics.hpp
@@ -13,6 +13,7 @@
 #ifndef __PROCESS_METRICS_METRICS_HPP__
 #define __PROCESS_METRICS_METRICS_HPP__
 
+#include <map>
 #include <string>
 
 #include <process/dispatch.hpp>
@@ -40,7 +41,7 @@ public:
 
   Future<Nothing> remove(const std::string& name);
 
-  Future<hashmap<std::string, double>> snapshot(
+  Future<std::map<std::string, double>> snapshot(
       const Option<Duration>& timeout);
 
 protected:
@@ -68,7 +69,7 @@ private:
   static std::list<Future<double>> _snapshotTimeout(
       const std::list<Future<double>>& futures);
 
-  static Future<hashmap<std::string, double>> __snapshot(
+  static Future<std::map<std::string, double>> __snapshot(
       const Option<Duration>& timeout,
       const hashmap<std::string, Future<double>>& metrics,
       const hashmap<std::string, Option<Statistics<double>>>& statistics);
@@ -117,7 +118,7 @@ inline Future<Nothing> remove(const Metric& metric)
 }
 
 
-inline Future<hashmap<std::string, double>> snapshot(
+inline Future<std::map<std::string, double>> snapshot(
     const Option<Duration>& timeout)
 {
   // The metrics process is instantiated in `process::initialize`.

http://git-wip-us.apache.org/repos/asf/mesos/blob/3d5bf3fb/3rdparty/libprocess/src/metrics/metrics.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/metrics/metrics.cpp b/3rdparty/libprocess/src/metrics/metrics.cpp
index 7184aa4..f795418 100644
--- a/3rdparty/libprocess/src/metrics/metrics.cpp
+++ b/3rdparty/libprocess/src/metrics/metrics.cpp
@@ -13,6 +13,7 @@
 #include <glog/logging.h>
 
 #include <list>
+#include <map>
 #include <string>
 #include <vector>
 
@@ -33,6 +34,7 @@
 #include <stout/os.hpp>
 
 using std::list;
+using std::map;
 using std::string;
 using std::vector;
 
@@ -149,7 +151,7 @@ Future<Nothing> MetricsProcess::remove(const string& name)
 }
 
 
-Future<hashmap<string, double>> MetricsProcess::snapshot(
+Future<map<string, double>> MetricsProcess::snapshot(
     const Option<Duration>& timeout)
 {
   hashmap<string, Future<double>> futures;
@@ -200,7 +202,7 @@ Future<http::Response> MetricsProcess::_snapshot(
   }
 
   return acquire.then(defer(self(), &Self::snapshot, timeout))
-      .then([request](const hashmap<string, double>& metrics)
+      .then([request](const map<string, double>& metrics)
             -> http::Response {
         return http::OK(jsonify(metrics), request.url.query.get("jsonp"));
       });
@@ -216,12 +218,12 @@ list<Future<double>> MetricsProcess::_snapshotTimeout(
 }
 
 
-Future<hashmap<string, double>> MetricsProcess::__snapshot(
+Future<map<string, double>> MetricsProcess::__snapshot(
     const Option<Duration>& timeout,
     const hashmap<string, Future<double>>& metrics,
     const hashmap<string, Option<Statistics<double>>>& statistics)
 {
-  hashmap<string, double> snapshot;
+  map<string, double> snapshot;
 
   foreachpair (const string& key, const Future<double>& value, metrics) {
     // TODO(dhamon): Maybe add the failure message for this metric to the


[3/3] mesos git commit: Removed gtest thread safe filter in libprocess tests.

Posted by bm...@apache.org.
Removed gtest thread safe filter in libprocess tests.

We require pthread and therefore the GTEST_IS_THREADSAFE macro
always returns true within the libprocess tests. Similar to what
is done in Mesos, we and exit if it's false.

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


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

Branch: refs/heads/master
Commit: e989b22664a8c7468eb028bccc2a5ead37f8501f
Parents: 064c0ee
Author: Benjamin Mahler <bm...@apache.org>
Authored: Sat Jan 6 19:58:44 2018 -0800
Committer: Benjamin Mahler <bm...@apache.org>
Committed: Mon Jan 8 17:44:39 2018 -0800

----------------------------------------------------------------------
 3rdparty/libprocess/src/tests/future_tests.cpp  |  2 +-
 3rdparty/libprocess/src/tests/io_tests.cpp      | 10 ++---
 3rdparty/libprocess/src/tests/limiter_tests.cpp |  6 +--
 3rdparty/libprocess/src/tests/main.cpp          | 28 +++---------
 3rdparty/libprocess/src/tests/process_tests.cpp | 46 ++++++++++----------
 3rdparty/libprocess/src/tests/reap_tests.cpp    |  4 +-
 6 files changed, 41 insertions(+), 55 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/e989b226/3rdparty/libprocess/src/tests/future_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/future_tests.cpp b/3rdparty/libprocess/src/tests/future_tests.cpp
index 3dadd72..bd98154 100644
--- a/3rdparty/libprocess/src/tests/future_tests.cpp
+++ b/3rdparty/libprocess/src/tests/future_tests.cpp
@@ -621,7 +621,7 @@ TEST(FutureTest, Discard3)
 }
 
 
-TEST(FutureTest, THREADSAFE_Select)
+TEST(FutureTest, Select)
 {
   Promise<int> promise1;
   Promise<int> promise2;

http://git-wip-us.apache.org/repos/asf/mesos/blob/e989b226/3rdparty/libprocess/src/tests/io_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/io_tests.cpp b/3rdparty/libprocess/src/tests/io_tests.cpp
index cc62d2f..c091962 100644
--- a/3rdparty/libprocess/src/tests/io_tests.cpp
+++ b/3rdparty/libprocess/src/tests/io_tests.cpp
@@ -33,7 +33,7 @@ using std::string;
 
 class IOTest: public TemporaryDirectoryTest {};
 
-TEST_F(IOTest, THREADSAFE_Poll)
+TEST_F(IOTest, Poll)
 {
   int pipes[2];
   ASSERT_NE(-1, pipe(pipes));
@@ -55,7 +55,7 @@ TEST_F(IOTest, THREADSAFE_Poll)
 }
 
 
-TEST_F(IOTest, THREADSAFE_Read)
+TEST_F(IOTest, Read)
 {
   int pipes[2];
   char data[3];
@@ -174,7 +174,7 @@ TEST_F(IOTest, BufferedRead)
 }
 
 
-TEST_F(IOTest, THREADSAFE_Write)
+TEST_F(IOTest, Write)
 {
   int pipes[2];
 
@@ -213,7 +213,7 @@ TEST_F(IOTest, THREADSAFE_Write)
 }
 
 
-TEST_F(IOTest, DISABLED_THREADSAFE_BlockingWrite)
+TEST_F(IOTest, DISABLED_BlockingWrite)
 {
   int pipes[2];
 
@@ -286,7 +286,7 @@ TEST_F(IOTest, DISABLED_THREADSAFE_BlockingWrite)
 }
 
 
-TEST_F(IOTest, THREADSAFE_Redirect)
+TEST_F(IOTest, Redirect)
 {
   // Start by checking that using "invalid" file descriptors fails.
   AWAIT_EXPECT_FAILED(io::redirect(-1, 0));

http://git-wip-us.apache.org/repos/asf/mesos/blob/e989b226/3rdparty/libprocess/src/tests/limiter_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/limiter_tests.cpp b/3rdparty/libprocess/src/tests/limiter_tests.cpp
index 70a224c..2c8c63e 100644
--- a/3rdparty/libprocess/src/tests/limiter_tests.cpp
+++ b/3rdparty/libprocess/src/tests/limiter_tests.cpp
@@ -27,7 +27,7 @@ using process::Future;
 using process::RateLimiter;
 
 
-TEST(LimiterTest, THREADSAFE_Acquire)
+TEST(LimiterTest, Acquire)
 {
   int permits = 2;
   Duration duration = Milliseconds(5);
@@ -55,7 +55,7 @@ TEST(LimiterTest, THREADSAFE_Acquire)
 // In this test 4 permits are given, but the 2nd permit's acquire
 // is immediately discarded. So, 1st, 3rd and 4th permits should
 // be acquired according to the rate limit.
-TEST(LimiterTest, THREADSAFE_DiscardMiddle)
+TEST(LimiterTest, DiscardMiddle)
 {
   int permits = 2;
   Duration duration = Milliseconds(5);
@@ -91,7 +91,7 @@ TEST(LimiterTest, THREADSAFE_DiscardMiddle)
 // In this test 2 permits are initially given, but the 2nd permit's
 // future is immediately discarded. Then the 3rd permit is given. So,
 // 1st and 3rd permits should be acquired according to the rate limit.
-TEST(LimiterTest, THREADSAFE_DiscardLast)
+TEST(LimiterTest, DiscardLast)
 {
   int permits = 2;
   Duration duration = Milliseconds(5);

http://git-wip-us.apache.org/repos/asf/mesos/blob/e989b226/3rdparty/libprocess/src/tests/main.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/main.cpp b/3rdparty/libprocess/src/tests/main.cpp
index 1cbd37c..4633bea 100644
--- a/3rdparty/libprocess/src/tests/main.cpp
+++ b/3rdparty/libprocess/src/tests/main.cpp
@@ -27,6 +27,8 @@
 #include <process/gtest.hpp>
 #include <process/process.hpp>
 
+#include <stout/exit.hpp>
+
 #ifndef __WINDOWS__
 #include <stout/os/signals.hpp>
 #endif // __WINDOWS__
@@ -41,26 +43,6 @@ using std::vector;
 using stout::internal::tests::Environment;
 using stout::internal::tests::TestFilter;
 
-
-class ThreadsafeFilter : public TestFilter
-{
-public:
-  ThreadsafeFilter()
-#if GTEST_IS_THREADSAFE
-    : is_threadsafe(true) {}
-#else
-    : is_threadsafe(false) {}
-#endif
-
-  bool disable(const ::testing::TestInfo* test) const override
-  {
-    return matches(test, "THREADSAFE_") && !is_threadsafe;
-  }
-
-private:
-  const bool is_threadsafe;
-};
-
 using std::shared_ptr;
 using std::vector;
 
@@ -79,6 +61,10 @@ int main(int argc, char** argv)
   // Initialize Google Mock/Test.
   testing::InitGoogleMock(&argc, argv);
 
+#if !GTEST_IS_THREADSAFE
+  EXIT(EXIT_FAILURE) << "Testing environment is not thread safe, bailing!";
+#endif // !GTEST_IS_THREADSAFE
+
   // Initialize libprocess.
   process::initialize(
       None(),
@@ -97,7 +83,7 @@ int main(int argc, char** argv)
   os::signals::reset(SIGTERM);
 #endif // __WINDOWS__
 
-  vector<shared_ptr<TestFilter>> filters = {make_shared<ThreadsafeFilter>()};
+  vector<shared_ptr<TestFilter>> filters = {};
   Environment* environment = new Environment(filters);
   testing::AddGlobalTestEnvironment(environment);
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/e989b226/3rdparty/libprocess/src/tests/process_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/process_tests.cpp b/3rdparty/libprocess/src/tests/process_tests.cpp
index 58741b2..96b1675 100644
--- a/3rdparty/libprocess/src/tests/process_tests.cpp
+++ b/3rdparty/libprocess/src/tests/process_tests.cpp
@@ -127,7 +127,7 @@ public:
 };
 
 
-TEST(ProcessTest, THREADSAFE_Spawn)
+TEST(ProcessTest, Spawn)
 {
   SpawnProcess process;
 
@@ -175,7 +175,7 @@ public:
 };
 
 
-TEST(ProcessTest, THREADSAFE_Dispatch)
+TEST(ProcessTest, Dispatch)
 {
   DispatchProcess process;
 
@@ -211,7 +211,7 @@ TEST(ProcessTest, THREADSAFE_Dispatch)
 }
 
 
-TEST(ProcessTest, THREADSAFE_Defer1)
+TEST(ProcessTest, Defer1)
 {
   DispatchProcess process;
 
@@ -331,7 +331,7 @@ private:
 };
 
 
-TEST(ProcessTest, THREADSAFE_Defer2)
+TEST(ProcessTest, Defer2)
 {
   DeferProcess process;
 
@@ -363,7 +363,7 @@ void set(T* t1, const T& t2)
 }
 
 
-TEST(ProcessTest, THREADSAFE_Defer3)
+TEST(ProcessTest, Defer3)
 {
   std::atomic_bool bool1(false);
   std::atomic_bool bool2(false);
@@ -395,7 +395,7 @@ public:
 };
 
 
-TEST(ProcessTest, THREADSAFE_Handlers)
+TEST(ProcessTest, Handlers)
 {
   HandlersProcess process;
 
@@ -418,7 +418,7 @@ TEST(ProcessTest, THREADSAFE_Handlers)
 
 // Tests DROP_MESSAGE and DROP_DISPATCH and in particular that an
 // event can get dropped before being processed.
-TEST(ProcessTest, THREADSAFE_Expect)
+TEST(ProcessTest, Expect)
 {
   HandlersProcess process;
 
@@ -447,7 +447,7 @@ TEST(ProcessTest, THREADSAFE_Expect)
 
 
 // Tests the FutureArg<N> action.
-TEST(ProcessTest, THREADSAFE_Action)
+TEST(ProcessTest, Action)
 {
   HandlersProcess process;
 
@@ -492,7 +492,7 @@ public:
 };
 
 
-TEST(ProcessTest, THREADSAFE_Inheritance)
+TEST(ProcessTest, Inheritance)
 {
   DerivedProcess process;
 
@@ -520,7 +520,7 @@ TEST(ProcessTest, THREADSAFE_Inheritance)
 }
 
 
-TEST(ProcessTest, THREADSAFE_Thunk)
+TEST(ProcessTest, Thunk)
 {
   struct Thunk
   {
@@ -563,7 +563,7 @@ public:
 };
 
 
-TEST(ProcessTest, THREADSAFE_Delegate)
+TEST(ProcessTest, Delegate)
 {
   DelegateeProcess delegatee;
   DelegatorProcess delegator(delegatee.self());
@@ -594,7 +594,7 @@ public:
 };
 
 
-TEST(ProcessTest, THREADSAFE_Delay)
+TEST(ProcessTest, Delay)
 {
   Clock::pause();
 
@@ -631,7 +631,7 @@ public:
 };
 
 
-TEST(ProcessTest, THREADSAFE_Order)
+TEST(ProcessTest, Order)
 {
   Clock::pause();
 
@@ -684,7 +684,7 @@ public:
 };
 
 
-TEST(ProcessTest, THREADSAFE_Donate)
+TEST(ProcessTest, Donate)
 {
   DonateProcess process;
   spawn(process);
@@ -1182,7 +1182,7 @@ public:
 };
 
 
-TEST(ProcessTest, THREADSAFE_Settle)
+TEST(ProcessTest, Settle)
 {
   Clock::pause();
   SettleProcess process;
@@ -1195,7 +1195,7 @@ TEST(ProcessTest, THREADSAFE_Settle)
 }
 
 
-TEST(ProcessTest, THREADSAFE_Pid)
+TEST(ProcessTest, Pid)
 {
   TimeoutProcess process;
 
@@ -1228,7 +1228,7 @@ public:
 };
 
 
-TEST(ProcessTest, THREADSAFE_Listener)
+TEST(ProcessTest, Listener)
 {
   MultipleListenerProcess process;
 
@@ -1254,7 +1254,7 @@ public:
 };
 
 
-TEST(ProcessTest, THREADSAFE_Executor_Defer)
+TEST(ProcessTest, Executor_Defer)
 {
   EventReceiver receiver;
   Executor executor;
@@ -1293,7 +1293,7 @@ TEST(ProcessTest, THREADSAFE_Executor_Defer)
 }
 
 
-TEST(ProcessTest, THREADSAFE_Executor_Execute)
+TEST(ProcessTest, Executor_Execute)
 {
   Executor executor;
 
@@ -1361,7 +1361,7 @@ public:
 };
 
 
-TEST(ProcessTest, THREADSAFE_Remote)
+TEST(ProcessTest, Remote)
 {
   RemoteProcess process;
   spawn(process);
@@ -1397,7 +1397,7 @@ TEST(ProcessTest, THREADSAFE_Remote)
 
 
 // Like the 'remote' test but uses http::connect.
-TEST(ProcessTest, THREADSAFE_Http1)
+TEST(ProcessTest, Http1)
 {
   RemoteProcess process;
   spawn(process);
@@ -1452,7 +1452,7 @@ TEST(ProcessTest, THREADSAFE_Http1)
 // also use http::post here since we expect a 202 response.
 //
 // TODO(neilc): This test currently does not work on Windows (MESOS-7527).
-TEST_TEMP_DISABLED_ON_WINDOWS(ProcessTest, THREADSAFE_Http2)
+TEST_TEMP_DISABLED_ON_WINDOWS(ProcessTest, Http2)
 {
   RemoteProcess process;
   spawn(process);
@@ -1562,7 +1562,7 @@ static string itoa2(int* const& i)
 }
 
 
-TEST(ProcessTest, THREADSAFE_Async)
+TEST(ProcessTest, Async)
 {
   // Non-void functions with different no.of args.
   EXPECT_EQ(1, async(&foo).get());

http://git-wip-us.apache.org/repos/asf/mesos/blob/e989b226/3rdparty/libprocess/src/tests/reap_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/reap_tests.cpp b/3rdparty/libprocess/src/tests/reap_tests.cpp
index 7e7aadc..f8a8593 100644
--- a/3rdparty/libprocess/src/tests/reap_tests.cpp
+++ b/3rdparty/libprocess/src/tests/reap_tests.cpp
@@ -103,7 +103,7 @@ TEST(ReapTest, NonChildProcess)
 
 // This test checks that the we can reap a child process and obtain
 // the correct exit status.
-TEST(ReapTest, THREADSAFE_ChildProcess)
+TEST(ReapTest, ChildProcess)
 {
   // The child process sleeps and will be killed by the parent.
   Try<ProcessTree> tree = Fork(None(),
@@ -134,7 +134,7 @@ TEST(ReapTest, THREADSAFE_ChildProcess)
 
 
 // Check that we can reap a child process that is already exited.
-TEST(ReapTest, THREADSAFE_TerminatedChildProcess)
+TEST(ReapTest, TerminatedChildProcess)
 {
   // The child process immediately exits.
   Try<ProcessTree> tree = Fork(None(),


[2/3] mesos git commit: Added tests to ensure that libprocess metrics are alphabetical.

Posted by bm...@apache.org.
Added tests to ensure that libprocess metrics are alphabetical.

For human readability, we ensure that metrics are ordered
alphabetically in the JSON response.

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


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

Branch: refs/heads/master
Commit: 064c0ee4c7347b63fca20d15d835b07b47e78a85
Parents: 3d5bf3f
Author: Benjamin Mahler <bm...@apache.org>
Authored: Sat Jan 6 19:48:36 2018 -0800
Committer: Benjamin Mahler <bm...@apache.org>
Committed: Mon Jan 8 17:44:37 2018 -0800

----------------------------------------------------------------------
 3rdparty/libprocess/src/tests/metrics_tests.cpp | 52 ++++++++++++++++++++
 1 file changed, 52 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/064c0ee4/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 bb7c9e3..5f7117e 100644
--- a/3rdparty/libprocess/src/tests/metrics_tests.cpp
+++ b/3rdparty/libprocess/src/tests/metrics_tests.cpp
@@ -14,6 +14,7 @@
 
 #include <map>
 #include <string>
+#include <vector>
 
 #include <stout/base64.hpp>
 #include <stout/duration.hpp>
@@ -61,6 +62,7 @@ using process::UPID;
 
 using std::map;
 using std::string;
+using std::vector;
 
 class GaugeProcess : public Process<GaugeProcess>
 {
@@ -282,6 +284,56 @@ TEST_F(MetricsTest, THREADSAFE_Snapshot)
 }
 
 
+// Ensure the response string has the JSON keys sorted
+// alphabetically, we do this for easier human consumption.
+TEST_F(MetricsTest, SnapshotAlphabetical)
+{
+  UPID upid("metrics", process::address());
+
+  Clock::pause();
+
+  vector<Counter> counters = {
+    Counter("test/f"),
+    Counter("test/e"),
+    Counter("test/d"),
+    Counter("test/c"),
+    Counter("test/b"),
+    Counter("test/a"),
+  };
+
+  foreach (const Counter& counter, counters) {
+    AWAIT_READY(metrics::add(counter));
+  }
+
+  // Advance the clock to avoid rate limit.
+  Clock::advance(Seconds(1));
+
+  // Get the snapshot.
+  Future<Response> response = http::get(upid, "snapshot");
+  AWAIT_EXPECT_RESPONSE_STATUS_EQ(OK().status, response);
+
+  // Ensure the response is ordered alphabetically.
+  EXPECT_LT(response->body.find("test\\/e"),
+            response->body.find("test\\/f"));
+
+  EXPECT_LT(response->body.find("test\\/d"),
+            response->body.find("test\\/e"));
+
+  EXPECT_LT(response->body.find("test\\/c"),
+            response->body.find("test\\/d"));
+
+  EXPECT_LT(response->body.find("test\\/b"),
+            response->body.find("test\\/c"));
+
+  EXPECT_LT(response->body.find("test\\/a"),
+            response->body.find("test\\/b"));
+
+  foreach (const Counter& counter, counters) {
+    AWAIT_READY(metrics::remove(counter));
+  }
+}
+
+
 TEST_F(MetricsTest, THREADSAFE_SnapshotTimeout)
 {
   UPID upid("metrics", process::address());