You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bb...@apache.org on 2018/02/21 13:33:44 UTC
[3/4] mesos git commit: Removed some redundant `get` calls in
libprocess.
Removed some redundant `get` calls in libprocess.
Review: https://reviews.apache.org/r/65161/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/0d96c616
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/0d96c616
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/0d96c616
Branch: refs/heads/master
Commit: 0d96c6167f9a12bfeeff87a65057f8af6a2fc443
Parents: e65fa46
Author: Benjamin Bannier <be...@mesosphere.io>
Authored: Wed Feb 21 14:24:52 2018 +0100
Committer: Benjamin Bannier <bb...@apache.org>
Committed: Wed Feb 21 14:26:56 2018 +0100
----------------------------------------------------------------------
3rdparty/libprocess/include/process/gmock.hpp | 7 +-
3rdparty/libprocess/include/process/gtest.hpp | 26 ++--
3rdparty/libprocess/include/process/system.hpp | 20 +--
3rdparty/libprocess/src/http.cpp | 2 +-
3rdparty/libprocess/src/http_proxy.cpp | 4 +-
3rdparty/libprocess/src/metrics/metrics.cpp | 20 +--
3rdparty/libprocess/src/openssl.cpp | 16 +--
3rdparty/libprocess/src/process.cpp | 10 +-
3rdparty/libprocess/src/ssl/utilities.cpp | 9 +-
3rdparty/libprocess/src/subprocess_posix.hpp | 2 +-
3rdparty/libprocess/src/tests/benchmarks.cpp | 4 +-
3rdparty/libprocess/src/tests/collect_tests.cpp | 6 +-
3rdparty/libprocess/src/tests/future_tests.cpp | 2 +-
3rdparty/libprocess/src/tests/http_tests.cpp | 66 ++++-----
3rdparty/libprocess/src/tests/metrics_tests.cpp | 41 +++---
3rdparty/libprocess/src/tests/process_tests.cpp | 4 +-
3rdparty/libprocess/src/tests/reap_tests.cpp | 10 +-
3rdparty/libprocess/src/tests/ssl_tests.cpp | 66 ++++-----
.../libprocess/src/tests/statistics_tests.cpp | 18 +--
.../libprocess/src/tests/subprocess_tests.cpp | 142 +++++++++----------
3rdparty/libprocess/src/tests/system_tests.cpp | 6 +-
.../libprocess/src/tests/timeseries_tests.cpp | 2 +-
22 files changed, 233 insertions(+), 250 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/0d96c616/3rdparty/libprocess/include/process/gmock.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/gmock.hpp b/3rdparty/libprocess/include/process/gmock.hpp
index 231efcd..b5ead1c 100644
--- a/3rdparty/libprocess/include/process/gmock.hpp
+++ b/3rdparty/libprocess/include/process/gmock.hpp
@@ -401,10 +401,9 @@ MATCHER_P4(UnionHttpMatcher, message, unionType, path, deserializer, "")
return false;
}
- return (testing::Matcher<unionType_type>(unionType).Matches(
- message_.get().type()) &&
- testing::Matcher<std::string>(path).Matches(
- event.request->url.path));
+ return (
+ testing::Matcher<unionType_type>(unionType).Matches(message_->type()) &&
+ testing::Matcher<std::string>(path).Matches(event.request->url.path));
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/0d96c616/3rdparty/libprocess/include/process/gtest.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/gtest.hpp b/3rdparty/libprocess/include/process/gtest.hpp
index 307cbfe..dd4c9bd 100644
--- a/3rdparty/libprocess/include/process/gtest.hpp
+++ b/3rdparty/libprocess/include/process/gtest.hpp
@@ -423,15 +423,15 @@ inline ::testing::AssertionResult AwaitAssertResponseStatusEq(
AwaitAssertReady(actualExpr, durationExpr, actual, duration);
if (result) {
- if (expected == actual.get().status) {
+ if (expected == actual->status) {
return ::testing::AssertionSuccess();
} else {
return ::testing::AssertionFailure()
- << "Value of: (" << actualExpr << ").get().status\n"
- << " Actual: " << ::testing::PrintToString(actual.get().status) << "\n"
- << "Expected: " << expectedExpr << "\n"
- << "Which is: " << ::testing::PrintToString(expected) << "\n"
- << " Body: " << ::testing::PrintToString(actual.get().body);
+ << "Value of: (" << actualExpr << ")->status\n"
+ << " Actual: " << ::testing::PrintToString(actual->status) << "\n"
+ << "Expected: " << expectedExpr << "\n"
+ << "Which is: " << ::testing::PrintToString(expected) << "\n"
+ << " Body: " << ::testing::PrintToString(actual->body);
}
}
@@ -473,14 +473,14 @@ inline ::testing::AssertionResult AwaitAssertResponseBodyEq(
AwaitAssertReady(actualExpr, durationExpr, actual, duration);
if (result) {
- if (expected == actual.get().body) {
+ if (expected == actual->body) {
return ::testing::AssertionSuccess();
} else {
return ::testing::AssertionFailure()
- << "Value of: (" << actualExpr << ").get().body\n"
- << " Actual: " << ::testing::PrintToString(actual.get().body) << "\n"
- << "Expected: " << expectedExpr << "\n"
- << "Which is: " << ::testing::PrintToString(expected);
+ << "Value of: (" << actualExpr << ")->body\n"
+ << " Actual: " << ::testing::PrintToString(actual->body) << "\n"
+ << "Expected: " << expectedExpr << "\n"
+ << "Which is: " << ::testing::PrintToString(expected);
}
}
@@ -524,7 +524,7 @@ inline ::testing::AssertionResult AwaitAssertResponseHeaderEq(
AwaitAssertReady(actualExpr, durationExpr, actual, duration);
if (result) {
- const Option<std::string> value = actual.get().headers.get(key);
+ const Option<std::string> value = actual->headers.get(key);
if (value.isNone()) {
return ::testing::AssertionFailure()
<< "Response does not contain header '" << key << "'";
@@ -532,7 +532,7 @@ inline ::testing::AssertionResult AwaitAssertResponseHeaderEq(
return ::testing::AssertionSuccess();
} else {
return ::testing::AssertionFailure()
- << "Value of: (" << actualExpr << ").get().headers[" << keyExpr << "]\n"
+ << "Value of: (" << actualExpr << ")->headers[" << keyExpr << "]\n"
<< " Actual: " << ::testing::PrintToString(value.get()) << "\n"
<< "Expected: " << expectedExpr << "\n"
<< "Which is: " << ::testing::PrintToString(expected);
http://git-wip-us.apache.org/repos/asf/mesos/blob/0d96c616/3rdparty/libprocess/include/process/system.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/system.hpp b/3rdparty/libprocess/include/process/system.hpp
index 21bd330..6bd815d 100644
--- a/3rdparty/libprocess/include/process/system.hpp
+++ b/3rdparty/libprocess/include/process/system.hpp
@@ -103,7 +103,7 @@ private:
{
Try<os::Load> load = os::loadavg();
if (load.isSome()) {
- return load.get().one;
+ return load->one;
}
return Failure("Failed to get loadavg: " + load.error());
}
@@ -113,7 +113,7 @@ private:
{
Try<os::Load> load = os::loadavg();
if (load.isSome()) {
- return load.get().five;
+ return load->five;
}
return Failure("Failed to get loadavg: " + load.error());
}
@@ -123,7 +123,7 @@ private:
{
Try<os::Load> load = os::loadavg();
if (load.isSome()) {
- return load.get().fifteen;
+ return load->fifteen;
}
return Failure("Failed to get loadavg: " + load.error());
}
@@ -143,7 +143,7 @@ private:
{
Try<os::Memory> memory = os::memory();
if (memory.isSome()) {
- return static_cast<double>(memory.get().total.bytes());
+ return static_cast<double>(memory->total.bytes());
}
return Failure("Failed to get memory: " + memory.error());
}
@@ -153,7 +153,7 @@ private:
{
Try<os::Memory> memory = os::memory();
if (memory.isSome()) {
- return static_cast<double>(memory.get().free.bytes());
+ return static_cast<double>(memory->free.bytes());
}
return Failure("Failed to get memory: " + memory.error());
}
@@ -164,9 +164,9 @@ private:
JSON::Object object;
Try<os::Load> load = os::loadavg();
if (load.isSome()) {
- object.values["avg_load_1min"] = load.get().one;
- object.values["avg_load_5min"] = load.get().five;
- object.values["avg_load_15min"] = load.get().fifteen;
+ object.values["avg_load_1min"] = load->one;
+ object.values["avg_load_5min"] = load->five;
+ object.values["avg_load_15min"] = load->fifteen;
}
Try<long> cpus = os::cpus();
@@ -176,8 +176,8 @@ private:
Try<os::Memory> memory = os::memory();
if (memory.isSome()) {
- object.values["mem_total_bytes"] = memory.get().total.bytes();
- object.values["mem_free_bytes"] = memory.get().free.bytes();
+ object.values["mem_total_bytes"] = memory->total.bytes();
+ object.values["mem_free_bytes"] = memory->free.bytes();
}
return http::OK(object, request.url.query.get("jsonp"));
http://git-wip-us.apache.org/repos/asf/mesos/blob/0d96c616/3rdparty/libprocess/src/http.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/http.cpp b/3rdparty/libprocess/src/http.cpp
index 76a65e0..63dd2c1 100644
--- a/3rdparty/libprocess/src/http.cpp
+++ b/3rdparty/libprocess/src/http.cpp
@@ -292,7 +292,7 @@ bool Request::acceptsEncoding(const string& encoding) const
// then the server SHOULD use the "identity" content-coding...
Option<string> accept = headers.get("Accept-Encoding");
- if (accept.isNone() || accept.get().empty()) {
+ if (accept.isNone() || accept->empty()) {
return false;
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/0d96c616/3rdparty/libprocess/src/http_proxy.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/http_proxy.cpp b/3rdparty/libprocess/src/http_proxy.cpp
index f584238..25d6379 100644
--- a/3rdparty/libprocess/src/http_proxy.cpp
+++ b/3rdparty/libprocess/src/http_proxy.cpp
@@ -257,12 +257,12 @@ void HttpProxy::stream(
if (chunk.isReady()) {
std::ostringstream out;
- if (chunk.get().empty()) {
+ if (chunk->empty()) {
// Finished reading.
out << "0\r\n" << "\r\n";
finished = true;
} else {
- out << std::hex << chunk.get().size() << "\r\n";
+ out << std::hex << chunk->size() << "\r\n";
out << chunk.get();
out << "\r\n";
http://git-wip-us.apache.org/repos/asf/mesos/blob/0d96c616/3rdparty/libprocess/src/metrics/metrics.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/metrics/metrics.cpp b/3rdparty/libprocess/src/metrics/metrics.cpp
index f795418..3a5bd3d 100644
--- a/3rdparty/libprocess/src/metrics/metrics.cpp
+++ b/3rdparty/libprocess/src/metrics/metrics.cpp
@@ -86,7 +86,7 @@ MetricsProcess* MetricsProcess::create(
<< "Failed to parse LIBPROCESS_METRICS_SNAPSHOT_ENDPOINT_RATE_LIMIT "
<< "'" << limit.get() << "'"
<< " (format is <number of requests>/<interval duration>)"
- << (reason.isSome() ? ": " + reason.get().message : "");
+ << (reason.isSome() ? ": " + reason->message : "");
}
}
@@ -239,15 +239,15 @@ Future<map<string, double>> MetricsProcess::__snapshot(
Option<Statistics<double>> statistics_ = statistics.get(key).get();
if (statistics_.isSome()) {
- snapshot[key + "/count"] = static_cast<double>(statistics_.get().count);
- snapshot[key + "/min"] = statistics_.get().min;
- snapshot[key + "/max"] = statistics_.get().max;
- snapshot[key + "/p50"] = statistics_.get().p50;
- snapshot[key + "/p90"] = statistics_.get().p90;
- snapshot[key + "/p95"] = statistics_.get().p95;
- snapshot[key + "/p99"] = statistics_.get().p99;
- snapshot[key + "/p999"] = statistics_.get().p999;
- snapshot[key + "/p9999"] = statistics_.get().p9999;
+ snapshot[key + "/count"] = static_cast<double>(statistics_->count);
+ snapshot[key + "/min"] = statistics_->min;
+ snapshot[key + "/max"] = statistics_->max;
+ snapshot[key + "/p50"] = statistics_->p50;
+ snapshot[key + "/p90"] = statistics_->p90;
+ snapshot[key + "/p95"] = statistics_->p95;
+ snapshot[key + "/p99"] = statistics_->p99;
+ snapshot[key + "/p999"] = statistics_->p999;
+ snapshot[key + "/p9999"] = statistics_->p9999;
}
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/0d96c616/3rdparty/libprocess/src/openssl.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/openssl.cpp b/3rdparty/libprocess/src/openssl.cpp
index f2fe90b..a4d5036 100644
--- a/3rdparty/libprocess/src/openssl.cpp
+++ b/3rdparty/libprocess/src/openssl.cpp
@@ -541,13 +541,11 @@ void reinitialize()
if (ssl_flags->verify_cert) {
// Set CA locations.
if (ssl_flags->ca_file.isSome() || ssl_flags->ca_dir.isSome()) {
- const char* ca_file = ssl_flags->ca_file.isSome()
- ? ssl_flags->ca_file.get().c_str()
- : nullptr;
+ const char* ca_file =
+ ssl_flags->ca_file.isSome() ? ssl_flags->ca_file->c_str() : nullptr;
- const char* ca_dir = ssl_flags->ca_dir.isSome()
- ? ssl_flags->ca_dir.get().c_str()
- : nullptr;
+ const char* ca_dir =
+ ssl_flags->ca_dir.isSome() ? ssl_flags->ca_dir->c_str() : nullptr;
if (SSL_CTX_load_verify_locations(ctx, ca_file, ca_dir) != 1) {
unsigned long error = ERR_get_error();
@@ -614,7 +612,7 @@ void reinitialize()
// Set certificate chain.
if (SSL_CTX_use_certificate_chain_file(
ctx,
- ssl_flags->cert_file.get().c_str()) != 1) {
+ ssl_flags->cert_file->c_str()) != 1) {
unsigned long error = ERR_get_error();
EXIT(EXIT_FAILURE)
<< "Could not load cert file '" << ssl_flags->cert_file.get() << "' "
@@ -623,9 +621,7 @@ void reinitialize()
// Set private key.
if (SSL_CTX_use_PrivateKey_file(
- ctx,
- ssl_flags->key_file.get().c_str(),
- SSL_FILETYPE_PEM) != 1) {
+ ctx, ssl_flags->key_file->c_str(), SSL_FILETYPE_PEM) != 1) {
unsigned long error = ERR_get_error();
EXIT(EXIT_FAILURE)
<< "Could not load key file '" << ssl_flags->key_file.get() << "' "
http://git-wip-us.apache.org/repos/asf/mesos/blob/0d96c616/3rdparty/libprocess/src/process.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/process.cpp b/3rdparty/libprocess/src/process.cpp
index 42e7adf..a3a96a3 100644
--- a/3rdparty/libprocess/src/process.cpp
+++ b/3rdparty/libprocess/src/process.cpp
@@ -903,7 +903,7 @@ void on_accept(const Future<Socket>& socket)
StreamingRequestDecoder* decoder = new StreamingRequestDecoder();
- socket.get().recv(data, size)
+ socket->recv(data, size)
.onAny(lambda::bind(
&internal::decode_recv,
lambda::_1,
@@ -1588,7 +1588,7 @@ void SocketManager::link(
return;
}
socket = create.get();
- int_fd s = socket.get().get();
+ int_fd s = socket->get();
CHECK(sockets.count(s) == 0);
sockets.emplace(s, socket.get());
@@ -1903,7 +1903,7 @@ void SocketManager::send_connect(
}
CHECK_SOME(poll_socket);
- Future<Nothing> connect = poll_socket.get().connect(message.to.address);
+ Future<Nothing> connect = poll_socket->connect(message.to.address);
connect.onAny(lambda::bind(
// TODO(benh): with C++14 we can use lambda instead of
// `std::bind` and capture `message` with a `std::move`.
@@ -2454,7 +2454,7 @@ long ProcessManager::init_threads()
Option<string> value = os::getenv(env_var);
if (value.isSome()) {
constexpr long maxval = 1024;
- Try<long> number = numify<long>(value.get().c_str());
+ Try<long> number = numify<long>(value->c_str());
if (number.isSome() && number.get() > 0L && number.get() <= maxval) {
VLOG(1) << "Overriding default number of worker threads "
<< num_worker_threads << ", using the value "
@@ -2684,7 +2684,7 @@ void ProcessManager::handle(
foreach (const Owned<firewall::FirewallRule>& rule, firewallRules) {
Option<Response> rejection = rule->apply(socket, *request);
if (rejection.isSome()) {
- VLOG(1) << "Returning '"<< rejection.get().status << "' for '"
+ VLOG(1) << "Returning '" << rejection->status << "' for '"
<< request->url.path << "' (firewall rule forbids request)";
// TODO(arojas): Get rid of the duplicated code to return an
http://git-wip-us.apache.org/repos/asf/mesos/blob/0d96c616/3rdparty/libprocess/src/ssl/utilities.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/ssl/utilities.cpp b/3rdparty/libprocess/src/ssl/utilities.cpp
index 9b1d622..4d3727d 100644
--- a/3rdparty/libprocess/src/ssl/utilities.cpp
+++ b/3rdparty/libprocess/src/ssl/utilities.cpp
@@ -192,7 +192,7 @@ Try<X509*> generate_x509(
name,
"CN",
MBSTRING_ASC,
- reinterpret_cast<const unsigned char*>(hostname.get().c_str()),
+ reinterpret_cast<const unsigned char*>(hostname->c_str()),
-1,
-1,
0) != 1) {
@@ -238,7 +238,7 @@ Try<X509*> generate_x509(
return Error("Failed to create alternative name: ASN1_STRING_new");
}
- Try<in_addr> in = ip.get().in();
+ Try<in_addr> in = ip->in();
if (in.isError()) {
ASN1_STRING_free(alt_name_str);
@@ -256,10 +256,7 @@ Try<X509*> generate_x509(
// For `iPAddress` we hand over a binary value as part of the
// specification.
- if (ASN1_STRING_set(
- alt_name_str,
- &in.get().s_addr,
- sizeof(in_addr_t)) == 0) {
+ if (ASN1_STRING_set(alt_name_str, &in->s_addr, sizeof(in_addr_t)) == 0) {
ASN1_STRING_free(alt_name_str);
GENERAL_NAME_free(alt_name);
sk_GENERAL_NAME_pop_free(alt_name_stack, GENERAL_NAME_free);
http://git-wip-us.apache.org/repos/asf/mesos/blob/0d96c616/3rdparty/libprocess/src/subprocess_posix.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/subprocess_posix.hpp b/3rdparty/libprocess/src/subprocess_posix.hpp
index 25eb44a..007058b 100644
--- a/3rdparty/libprocess/src/subprocess_posix.hpp
+++ b/3rdparty/libprocess/src/subprocess_posix.hpp
@@ -225,7 +225,7 @@ inline Try<pid_t> cloneChild(
if (environment.isSome()) {
// NOTE: We add 1 to the size for a `nullptr` terminator.
- envp = new char*[environment.get().size() + 1];
+ envp = new char*[environment->size() + 1];
size_t index = 0;
foreachpair (
http://git-wip-us.apache.org/repos/asf/mesos/blob/0d96c616/3rdparty/libprocess/src/tests/benchmarks.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/benchmarks.cpp b/3rdparty/libprocess/src/tests/benchmarks.cpp
index 48b5f5c..1368375 100644
--- a/3rdparty/libprocess/src/tests/benchmarks.cpp
+++ b/3rdparty/libprocess/src/tests/benchmarks.cpp
@@ -131,7 +131,7 @@ private:
if (messageSize.isError()) {
return http::BadRequest("Invalid 'messageSize': " + messageSize.error());
}
- message = string(messageSize.get().bytes(), '1');
+ message = string(messageSize->bytes(), '1');
Try<size_t> numify_ = numify<size_t>(parameters["requests"].get());
if (numify_.isError()) {
@@ -279,7 +279,7 @@ TEST(ProcessTest, Process_BENCHMARK_ClientServer)
Try<Duration> elapsed = Duration::parse(response.body);
ASSERT_SOME(elapsed);
- double throughput = numRequests / elapsed.get().secs();
+ double throughput = numRequests / elapsed->secs();
cout << "Client " << i << ": " << throughput << " rpcs / sec" << endl;
http://git-wip-us.apache.org/repos/asf/mesos/blob/0d96c616/3rdparty/libprocess/src/tests/collect_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/collect_tests.cpp b/3rdparty/libprocess/src/tests/collect_tests.cpp
index 7c2ba90..2b16f43 100644
--- a/3rdparty/libprocess/src/tests/collect_tests.cpp
+++ b/3rdparty/libprocess/src/tests/collect_tests.cpp
@@ -33,7 +33,7 @@ TEST(CollectTest, Ready)
Future<list<int>> collect = process::collect(empty);
AWAIT_READY(collect);
- EXPECT_TRUE(collect.get().empty());
+ EXPECT_TRUE(collect->empty());
Promise<int> promise1;
Promise<int> promise2;
@@ -168,7 +168,7 @@ TEST(AwaitTest, Success)
list<Future<int>> empty;
Future<list<Future<int>>> future = process::await(empty);
AWAIT_ASSERT_READY(future);
- EXPECT_TRUE(future.get().empty());
+ EXPECT_TRUE(future->empty());
Promise<int> promise1;
Promise<int> promise2;
@@ -191,7 +191,7 @@ TEST(AwaitTest, Success)
AWAIT_ASSERT_READY(future);
- EXPECT_EQ(futures.size(), future.get().size());
+ EXPECT_EQ(futures.size(), future->size());
// We expect them to be returned in the same order as the
// future list that was passed in.
http://git-wip-us.apache.org/repos/asf/mesos/blob/0d96c616/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 bd98154..0ecbb31 100644
--- a/3rdparty/libprocess/src/tests/future_tests.cpp
+++ b/3rdparty/libprocess/src/tests/future_tests.cpp
@@ -641,7 +641,7 @@ TEST(FutureTest, Select)
AWAIT_READY(future);
AWAIT_READY(future.get());
- EXPECT_EQ(42, future.get().get());
+ EXPECT_EQ(42, future->get());
futures.erase(promise1.future());
http://git-wip-us.apache.org/repos/asf/mesos/blob/0d96c616/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 a60f6b1..4a7e81e 100644
--- a/3rdparty/libprocess/src/tests/http_tests.cpp
+++ b/3rdparty/libprocess/src/tests/http_tests.cpp
@@ -635,26 +635,26 @@ TEST_P(HTTPTest, PathParse)
http::path::parse(pattern, "/books/0304827484/chapters/3");
ASSERT_SOME(parse);
- EXPECT_EQ(4u, parse.get().size());
- EXPECT_SOME_EQ("books", parse.get().get("books"));
- EXPECT_SOME_EQ("0304827484", parse.get().get("isbn"));
- EXPECT_SOME_EQ("chapters", parse.get().get("chapters"));
- EXPECT_SOME_EQ("3", parse.get().get("chapter"));
+ EXPECT_EQ(4u, parse->size());
+ EXPECT_SOME_EQ("books", parse->get("books"));
+ EXPECT_SOME_EQ("0304827484", parse->get("isbn"));
+ EXPECT_SOME_EQ("chapters", parse->get("chapters"));
+ EXPECT_SOME_EQ("3", parse->get("chapter"));
parse = http::path::parse(pattern, "/books/0304827484");
ASSERT_SOME(parse);
- EXPECT_EQ(2u, parse.get().size());
- EXPECT_SOME_EQ("books", parse.get().get("books"));
- EXPECT_SOME_EQ("0304827484", parse.get().get("isbn"));
+ EXPECT_EQ(2u, parse->size());
+ EXPECT_SOME_EQ("books", parse->get("books"));
+ EXPECT_SOME_EQ("0304827484", parse->get("isbn"));
parse = http::path::parse(pattern, "/books/0304827484/chapters");
ASSERT_SOME(parse);
- EXPECT_EQ(3u, parse.get().size());
- EXPECT_SOME_EQ("books", parse.get().get("books"));
- EXPECT_SOME_EQ("0304827484", parse.get().get("isbn"));
- EXPECT_SOME_EQ("chapters", parse.get().get("chapters"));
+ EXPECT_EQ(3u, parse->size());
+ EXPECT_SOME_EQ("books", parse->get("books"));
+ EXPECT_SOME_EQ("0304827484", parse->get("isbn"));
+ EXPECT_SOME_EQ("chapters", parse->get("chapters"));
parse = http::path::parse(pattern, "/foo/0304827484/chapters");
@@ -776,11 +776,11 @@ TEST_P(HTTPTest, StreamingGetComplete)
// The response should be ready since the headers were sent.
AWAIT_READY(response);
- EXPECT_SOME_EQ("chunked", response.get().headers.get("Transfer-Encoding"));
- ASSERT_EQ(http::Response::PIPE, response.get().type);
- ASSERT_SOME(response.get().reader);
+ EXPECT_SOME_EQ("chunked", response->headers.get("Transfer-Encoding"));
+ ASSERT_EQ(http::Response::PIPE, response->type);
+ ASSERT_SOME(response->reader);
- http::Pipe::Reader reader = response.get().reader.get();
+ http::Pipe::Reader reader = response->reader.get();
// There is no data to read yet.
Future<string> read = reader.read();
@@ -818,11 +818,11 @@ TEST_P(HTTPTest, StreamingGetFailure)
// The response should be ready since the headers were sent.
AWAIT_READY(response);
- EXPECT_SOME_EQ("chunked", response.get().headers.get("Transfer-Encoding"));
- ASSERT_EQ(http::Response::PIPE, response.get().type);
- ASSERT_SOME(response.get().reader);
+ EXPECT_SOME_EQ("chunked", response->headers.get("Transfer-Encoding"));
+ ASSERT_EQ(http::Response::PIPE, response->type);
+ ASSERT_SOME(response->reader);
- http::Pipe::Reader reader = response.get().reader.get();
+ http::Pipe::Reader reader = response->reader.get();
// There is no data to read yet.
Future<string> read = reader.read();
@@ -1734,24 +1734,24 @@ TEST(URLTest, ParseUrls)
{
Try<http::URL> url = URL::parse("https://auth.docker.com");
EXPECT_SOME(url);
- EXPECT_SOME_EQ("https", url.get().scheme);
- EXPECT_SOME_EQ(443, url.get().port);
- EXPECT_SOME_EQ("auth.docker.com", url.get().domain);
- EXPECT_EQ("/", url.get().path);
+ EXPECT_SOME_EQ("https", url->scheme);
+ EXPECT_SOME_EQ(443, url->port);
+ EXPECT_SOME_EQ("auth.docker.com", url->domain);
+ EXPECT_EQ("/", url->path);
url = URL::parse("http://docker.com/");
EXPECT_SOME(url);
- EXPECT_SOME_EQ("http", url.get().scheme);
- EXPECT_SOME_EQ(80, url.get().port);
- EXPECT_SOME_EQ("docker.com", url.get().domain);
- EXPECT_EQ("/", url.get().path);
+ EXPECT_SOME_EQ("http", url->scheme);
+ EXPECT_SOME_EQ(80, url->port);
+ EXPECT_SOME_EQ("docker.com", url->domain);
+ EXPECT_EQ("/", url->path);
url = URL::parse("http://registry.docker.com:1234/abc/1");
EXPECT_SOME(url);
- EXPECT_SOME_EQ("http", url.get().scheme);
- EXPECT_SOME_EQ(1234, url.get().port);
- EXPECT_SOME_EQ("registry.docker.com", url.get().domain);
- EXPECT_EQ("/abc/1", url.get().path);
+ EXPECT_SOME_EQ("http", url->scheme);
+ EXPECT_SOME_EQ(1234, url->port);
+ EXPECT_SOME_EQ("registry.docker.com", url->domain);
+ EXPECT_EQ("/abc/1", url->path);
// Missing scheme.
EXPECT_ERROR(URL::parse("mesos.com"));
@@ -1843,7 +1843,7 @@ TEST_F(HttpAuthenticationTest, Unauthorized)
EXPECT_EQ(
authentication.unauthorized->headers.get("WWW-Authenticate"),
- response.get().headers.get("WWW-Authenticate"));
+ response->headers.get("WWW-Authenticate"));
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/0d96c616/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 5a5a2e5..f2bd99b 100644
--- a/3rdparty/libprocess/src/tests/metrics_tests.cpp
+++ b/3rdparty/libprocess/src/tests/metrics_tests.cpp
@@ -190,17 +190,17 @@ TEST_F(MetricsTest, Statistics)
Option<Statistics<double>> statistics = counter.statistics();
EXPECT_SOME(statistics);
- EXPECT_EQ(11u, statistics.get().count);
+ EXPECT_EQ(11u, statistics->count);
- EXPECT_DOUBLE_EQ(0.0, statistics.get().min);
- EXPECT_DOUBLE_EQ(10.0, statistics.get().max);
+ EXPECT_DOUBLE_EQ(0.0, statistics->min);
+ EXPECT_DOUBLE_EQ(10.0, statistics->max);
- 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);
+ EXPECT_DOUBLE_EQ(5.0, statistics->p50);
+ EXPECT_DOUBLE_EQ(9.0, statistics->p90);
+ EXPECT_DOUBLE_EQ(9.5, statistics->p95);
+ EXPECT_DOUBLE_EQ(9.9, statistics->p99);
+ EXPECT_DOUBLE_EQ(9.99, statistics->p999);
+ EXPECT_DOUBLE_EQ(9.999, statistics->p9999);
AWAIT_READY(metrics::remove(counter));
}
@@ -235,11 +235,10 @@ TEST_F(MetricsTest, THREADSAFE_Snapshot)
AWAIT_EXPECT_RESPONSE_STATUS_EQ(OK().status, response);
// Parse the response.
- Try<JSON::Object> responseJSON =
- JSON::parse<JSON::Object>(response.get().body);
+ Try<JSON::Object> responseJSON = JSON::parse<JSON::Object>(response->body);
ASSERT_SOME(responseJSON);
- map<string, JSON::Value> values = responseJSON.get().values;
+ map<string, JSON::Value> values = responseJSON->values;
EXPECT_EQ(1u, values.count("test/counter"));
EXPECT_DOUBLE_EQ(0.0, values["test/counter"].as<JSON::Number>().as<double>());
@@ -270,10 +269,10 @@ TEST_F(MetricsTest, THREADSAFE_Snapshot)
AWAIT_EXPECT_RESPONSE_STATUS_EQ(OK().status, response);
// Parse the response.
- responseJSON = JSON::parse<JSON::Object>(response.get().body);
+ responseJSON = JSON::parse<JSON::Object>(response->body);
ASSERT_SOME(responseJSON);
- values = responseJSON.get().values;
+ values = responseJSON->values;
EXPECT_EQ(0u, values.count("test/counter"));
EXPECT_EQ(0u, values.count("test/gauge"));
EXPECT_EQ(0u, values.count("test/gauge_fail"));
@@ -387,14 +386,13 @@ TEST_F(MetricsTest, THREADSAFE_SnapshotTimeout)
AWAIT_EXPECT_RESPONSE_STATUS_EQ(OK().status, response);
// Parse the response.
- Try<JSON::Object> responseJSON =
- JSON::parse<JSON::Object>(response.get().body);
+ Try<JSON::Object> responseJSON = JSON::parse<JSON::Object>(response->body);
ASSERT_SOME(responseJSON);
// We can't use simple JSON equality testing here as initializing
// libprocess adds metrics to the system. We want to only check if
// the metrics from this test are correctly handled.
- map<string, JSON::Value> values = responseJSON.get().values;
+ map<string, JSON::Value> values = responseJSON->values;
EXPECT_EQ(1u, values.count("test/counter"));
EXPECT_DOUBLE_EQ(0.0, values["test/counter"].as<JSON::Number>().as<double>());
@@ -422,10 +420,10 @@ TEST_F(MetricsTest, THREADSAFE_SnapshotTimeout)
AWAIT_EXPECT_RESPONSE_STATUS_EQ(OK().status, response);
// Parse the response.
- responseJSON = JSON::parse<JSON::Object>(response.get().body);
+ responseJSON = JSON::parse<JSON::Object>(response->body);
ASSERT_SOME(responseJSON);
- values = responseJSON.get().values;
+ values = responseJSON->values;
ASSERT_SOME(responseJSON);
EXPECT_EQ(0u, values.count("test/counter"));
@@ -477,8 +475,7 @@ TEST_F(MetricsTest, SnapshotStatistics)
AWAIT_EXPECT_RESPONSE_STATUS_EQ(OK().status, response);
- Try<JSON::Object> responseJSON =
- JSON::parse<JSON::Object>(response.get().body);
+ Try<JSON::Object> responseJSON = JSON::parse<JSON::Object>(response->body);
ASSERT_SOME(responseJSON);
@@ -486,7 +483,7 @@ TEST_F(MetricsTest, SnapshotStatistics)
hashmap<string, double> responseValues;
foreachpair (const string& key,
const JSON::Value& value,
- responseJSON.get().values) {
+ responseJSON->values) {
if (value.is<JSON::Number>()) {
// "test/counter/count" is an integer, everything else is a double.
JSON::Number number = value.as<JSON::Number>();
http://git-wip-us.apache.org/repos/asf/mesos/blob/0d96c616/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 96b1675..2f8a823 100644
--- a/3rdparty/libprocess/src/tests/process_tests.cpp
+++ b/3rdparty/libprocess/src/tests/process_tests.cpp
@@ -1576,7 +1576,7 @@ TEST(ProcessTest, Async)
EXPECT_EQ("42", async(&itoa2, &i).get());
// Non-void function that returns a future.
- EXPECT_EQ("42", async(&itoa1, &i).get().get());
+ EXPECT_EQ("42", async(&itoa1, &i)->get());
}
@@ -1622,7 +1622,7 @@ TEST_TEMP_DISABLED_ON_WINDOWS(ProcessTest, Provide)
AWAIT_READY(response);
- ASSERT_EQ(LOREM_IPSUM, response.get().body);
+ ASSERT_EQ(LOREM_IPSUM, response->body);
terminate(server);
wait(server);
http://git-wip-us.apache.org/repos/asf/mesos/blob/0d96c616/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 f8a8593..953806b 100644
--- a/3rdparty/libprocess/src/tests/reap_tests.cpp
+++ b/3rdparty/libprocess/src/tests/reap_tests.cpp
@@ -58,8 +58,8 @@ TEST(ReapTest, NonChildProcess)
Fork(Exec(SLEEP_COMMAND(10))),
Exec("exit 0"))();
ASSERT_SOME(tree);
- ASSERT_EQ(1u, tree.get().children.size());
- pid_t grandchild = tree.get().children.front();
+ ASSERT_EQ(1u, tree->children.size());
+ pid_t grandchild = tree->children.front();
// Reap the grandchild process.
Future<Option<int>> status = process::reap(grandchild);
@@ -83,10 +83,10 @@ TEST(ReapTest, NonChildProcess)
AWAIT_READY(status);
// The status is None because pid is not an immediate child.
- ASSERT_NONE(status.get()) << status.get().get();
+ ASSERT_NONE(status.get()) << status->get();
// Reap the child as well to clean up after ourselves.
- status = process::reap(tree.get().process.pid);
+ status = process::reap(tree->process.pid);
// Now advance time until the child is reaped.
while (status.isPending()) {
@@ -151,7 +151,7 @@ TEST(ReapTest, TerminatedChildProcess)
const Result<os::Process> process = os::process(child);
ASSERT_SOME(process) << "Process " << child << " reaped unexpectedly";
- if (process.get().zombie) {
+ if (process->zombie) {
break;
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/0d96c616/3rdparty/libprocess/src/tests/ssl_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/ssl_tests.cpp b/3rdparty/libprocess/src/tests/ssl_tests.cpp
index 71f2df8..24fe220 100644
--- a/3rdparty/libprocess/src/tests/ssl_tests.cpp
+++ b/3rdparty/libprocess/src/tests/ssl_tests.cpp
@@ -250,7 +250,7 @@ TEST_F(SSLTest, SSLSocket)
true);
ASSERT_SOME(client);
- Future<Socket> socket = server.get().accept();
+ Future<Socket> socket = server->accept();
AWAIT_ASSERT_READY(socket);
// TODO(jmlvanre): Remove const copy.
@@ -279,7 +279,7 @@ TEST_F(SSLTest, NonSSLSocket)
false);
ASSERT_SOME(client);
- Future<Socket> socket = server.get().accept();
+ Future<Socket> socket = server->accept();
AWAIT_ASSERT_FAILED(socket);
AWAIT_ASSERT_READY(await_subprocess(client.get(), None()));
@@ -310,7 +310,7 @@ TEST_F(SSLTest, NoVerifyBadCA)
true);
ASSERT_SOME(client);
- Future<Socket> socket = server.get().accept();
+ Future<Socket> socket = server->accept();
AWAIT_ASSERT_READY(socket);
// TODO(jmlvanre): Remove const copy.
@@ -342,7 +342,7 @@ TEST_F(SSLTest, RequireBadCA)
true);
ASSERT_SOME(client);
- Future<Socket> socket = server.get().accept();
+ Future<Socket> socket = server->accept();
AWAIT_ASSERT_FAILED(socket);
AWAIT_ASSERT_READY(await_subprocess(client.get(), None()));
@@ -370,7 +370,7 @@ TEST_F(SSLTest, VerifyBadCA)
true);
ASSERT_SOME(client);
- Future<Socket> socket = server.get().accept();
+ Future<Socket> socket = server->accept();
AWAIT_ASSERT_FAILED(socket);
AWAIT_ASSERT_READY(await_subprocess(client.get(), None()));
@@ -400,7 +400,7 @@ TEST_F(SSLTest, VerifyCertificate)
true);
ASSERT_SOME(client);
- Future<Socket> socket = server.get().accept();
+ Future<Socket> socket = server->accept();
AWAIT_ASSERT_READY(socket);
// TODO(jmlvanre): Remove const copy.
@@ -436,7 +436,7 @@ TEST_P(SSLTest, RequireCertificate)
true);
ASSERT_SOME(client);
- Future<Socket> socket = server.get().accept();
+ Future<Socket> socket = server->accept();
AWAIT_ASSERT_READY(socket);
// TODO(jmlvanre): Remove const copy.
@@ -508,7 +508,7 @@ TEST_F(SSLTest, ProtocolMismatch)
if (server_protocol == client_protocol) {
// If the protocols are the same, it is valid.
- Future<Socket> socket = server.get().accept();
+ Future<Socket> socket = server->accept();
AWAIT_ASSERT_READY(socket);
// TODO(jmlvanre): Remove const copy.
@@ -518,7 +518,7 @@ TEST_F(SSLTest, ProtocolMismatch)
AWAIT_ASSERT_READY(await_subprocess(client.get(), 0));
} else {
// If the protocols are NOT the same, it is invalid.
- Future<Socket> socket = server.get().accept();
+ Future<Socket> socket = server->accept();
AWAIT_ASSERT_FAILED(socket);
AWAIT_ASSERT_READY(await_subprocess(client.get(), None()));
@@ -560,7 +560,7 @@ TEST_F(SSLTest, ECDHESupport)
launch_client(client_environment, server.get(), true);
ASSERT_SOME(client);
- Future<Socket> socket = server.get().accept();
+ Future<Socket> socket = server->accept();
AWAIT_ASSERT_READY(socket);
// TODO(jmlvanre): Remove const copy.
@@ -589,7 +589,7 @@ TEST_F(SSLTest, ValidDowngrade)
false);
ASSERT_SOME(client);
- Future<Socket> socket = server.get().accept();
+ Future<Socket> socket = server->accept();
AWAIT_ASSERT_READY(socket);
// TODO(jmlvanre): Remove const copy.
@@ -618,7 +618,7 @@ TEST_F(SSLTest, NoValidDowngrade)
false);
ASSERT_SOME(client);
- Future<Socket> socket = server.get().accept();
+ Future<Socket> socket = server->accept();
AWAIT_ASSERT_FAILED(socket);
AWAIT_ASSERT_READY(await_subprocess(client.get(), None()));
@@ -659,7 +659,7 @@ TEST_F(SSLTest, ValidDowngradeEachProtocol)
false);
ASSERT_SOME(client);
- Future<Socket> socket = server.get().accept();
+ Future<Socket> socket = server->accept();
AWAIT_ASSERT_READY(socket);
// TODO(jmlvanre): Remove const copy.
@@ -706,7 +706,7 @@ TEST_F(SSLTest, NoValidDowngradeEachProtocol)
false);
ASSERT_SOME(client);
- Future<Socket> socket = server.get().accept();
+ Future<Socket> socket = server->accept();
AWAIT_ASSERT_FAILED(socket);
AWAIT_ASSERT_READY(await_subprocess(client.get(), None()));
@@ -728,9 +728,9 @@ TEST_F(SSLTest, PeerAddress)
Socket client = client_create.get();
- Future<Socket> socket = server.get().accept();
+ Future<Socket> socket = server->accept();
- const Try<Address> server_address = server.get().address();
+ const Try<Address> server_address = server->address();
ASSERT_SOME(server_address);
const Future<Nothing> connect = client.connect(server_address.get());
@@ -738,7 +738,7 @@ TEST_F(SSLTest, PeerAddress)
AWAIT_ASSERT_READY(socket);
AWAIT_ASSERT_READY(connect);
- const Try<Address> socket_address = socket.get().address();
+ const Try<Address> socket_address = socket->address();
ASSERT_SOME(socket_address);
// Ensure the client thinks its peer is the server.
@@ -747,7 +747,7 @@ TEST_F(SSLTest, PeerAddress)
// Ensure the client has an address, and that the server thinks its
// peer is the client.
ASSERT_SOME(client.address());
- ASSERT_SOME_EQ(client.address().get(), socket.get().peer());
+ ASSERT_SOME_EQ(client.address().get(), socket->peer());
}
@@ -760,16 +760,14 @@ TEST_F(SSLTest, HTTPSGet)
{"LIBPROCESS_SSL_CERT_FILE", certificate_path().string()}});
ASSERT_SOME(server);
- ASSERT_SOME(server.get().address());
- ASSERT_SOME(server.get().address().get().hostname());
+ ASSERT_SOME(server->address());
+ ASSERT_SOME(server->address()->hostname());
- Future<Socket> socket = server.get().accept();
+ Future<Socket> socket = server->accept();
// Create URL from server hostname and port.
const http::URL url(
- "https",
- server.get().address().get().hostname().get(),
- server.get().address().get().port);
+ "https", server->address()->hostname().get(), server->address()->port);
// Send GET request.
Future<http::Response> response = http::get(url);
@@ -787,7 +785,7 @@ TEST_F(SSLTest, HTTPSGet)
AWAIT_ASSERT_READY(response);
AWAIT_EXPECT_RESPONSE_STATUS_EQ(http::OK().status, response);
- ASSERT_EQ(data, response.get().body);
+ ASSERT_EQ(data, response->body);
}
@@ -800,16 +798,14 @@ TEST_F(SSLTest, HTTPSPost)
{"LIBPROCESS_SSL_CERT_FILE", certificate_path().string()}});
ASSERT_SOME(server);
- ASSERT_SOME(server.get().address());
- ASSERT_SOME(server.get().address().get().hostname());
+ ASSERT_SOME(server->address());
+ ASSERT_SOME(server->address()->hostname());
- Future<Socket> socket = server.get().accept();
+ Future<Socket> socket = server->accept();
// Create URL from server hostname and port.
const http::URL url(
- "https",
- server.get().address().get().hostname().get(),
- server.get().address().get().port);
+ "https", server->address()->hostname().get(), server->address()->port);
// Send POST request.
Future<http::Response> response =
@@ -828,7 +824,7 @@ TEST_F(SSLTest, HTTPSPost)
AWAIT_ASSERT_READY(response);
AWAIT_EXPECT_RESPONSE_STATUS_EQ(http::OK().status, response);
- ASSERT_EQ(data, response.get().body);
+ ASSERT_EQ(data, response->body);
}
@@ -902,10 +898,10 @@ TEST_F(SSLTest, ShutdownThenSend)
{"LIBPROCESS_SSL_CERT_FILE", certificate_path().string()}});
ASSERT_SOME(server);
- ASSERT_SOME(server.get().address());
- ASSERT_SOME(server.get().address().get().hostname());
+ ASSERT_SOME(server->address());
+ ASSERT_SOME(server->address()->hostname());
- Future<Socket> socket = server.get().accept();
+ Future<Socket> socket = server->accept();
Clock::settle();
EXPECT_TRUE(socket.isPending());
http://git-wip-us.apache.org/repos/asf/mesos/blob/0d96c616/3rdparty/libprocess/src/tests/statistics_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/statistics_tests.cpp b/3rdparty/libprocess/src/tests/statistics_tests.cpp
index 144b510..a2a780b 100644
--- a/3rdparty/libprocess/src/tests/statistics_tests.cpp
+++ b/3rdparty/libprocess/src/tests/statistics_tests.cpp
@@ -57,15 +57,15 @@ TEST(StatisticsTest, Statistics)
EXPECT_SOME(statistics);
- EXPECT_EQ(11u, statistics.get().count);
+ EXPECT_EQ(11u, statistics->count);
- EXPECT_DOUBLE_EQ(-5.0, statistics.get().min);
- EXPECT_DOUBLE_EQ(5.0, statistics.get().max);
+ EXPECT_DOUBLE_EQ(-5.0, statistics->min);
+ EXPECT_DOUBLE_EQ(5.0, statistics->max);
- EXPECT_DOUBLE_EQ(0.0, statistics.get().p50);
- EXPECT_DOUBLE_EQ(4.0, statistics.get().p90);
- EXPECT_DOUBLE_EQ(4.5, statistics.get().p95);
- EXPECT_DOUBLE_EQ(4.9, statistics.get().p99);
- EXPECT_DOUBLE_EQ(4.99, statistics.get().p999);
- EXPECT_DOUBLE_EQ(4.999, statistics.get().p9999);
+ EXPECT_DOUBLE_EQ(0.0, statistics->p50);
+ EXPECT_DOUBLE_EQ(4.0, statistics->p90);
+ EXPECT_DOUBLE_EQ(4.5, statistics->p95);
+ EXPECT_DOUBLE_EQ(4.9, statistics->p99);
+ EXPECT_DOUBLE_EQ(4.99, statistics->p999);
+ EXPECT_DOUBLE_EQ(4.999, statistics->p9999);
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/0d96c616/3rdparty/libprocess/src/tests/subprocess_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/subprocess_tests.cpp b/3rdparty/libprocess/src/tests/subprocess_tests.cpp
index ead5ded..be99bd6 100644
--- a/3rdparty/libprocess/src/tests/subprocess_tests.cpp
+++ b/3rdparty/libprocess/src/tests/subprocess_tests.cpp
@@ -62,14 +62,14 @@ void run_subprocess(const lambda::function<Try<Subprocess>()>& createSubprocess)
// Advance time until the internal reaper reaps the subprocess.
Clock::pause();
- while (s.get().status().isPending()) {
+ while (s->status().isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
Clock::resume();
// Check process exited cleanly.
- AWAIT_EXPECT_WEXITSTATUS_EQ(0, s.get().status());
+ AWAIT_EXPECT_WEXITSTATUS_EQ(0, s->status());
}
@@ -240,13 +240,13 @@ TEST_F(SubprocessTest, Status)
// Advance time until the internal reaper reaps the subprocess.
Clock::pause();
- while (s.get().status().isPending()) {
+ while (s->status().isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
Clock::resume();
- AWAIT_EXPECT_WEXITSTATUS_EQ(0, s.get().status());
+ AWAIT_EXPECT_WEXITSTATUS_EQ(0, s->status());
// Exit 1.
s = subprocess("exit 1");
@@ -255,47 +255,47 @@ TEST_F(SubprocessTest, Status)
// Advance time until the internal reaper reaps the subprocess.
Clock::pause();
- while (s.get().status().isPending()) {
+ while (s->status().isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
Clock::resume();
- AWAIT_EXPECT_WEXITSTATUS_EQ(1, s.get().status());
+ AWAIT_EXPECT_WEXITSTATUS_EQ(1, s->status());
// SIGTERM.
s = subprocess(SLEEP_COMMAND(60));
ASSERT_SOME(s);
- kill(s.get().pid(), SIGTERM);
+ kill(s->pid(), SIGTERM);
// Advance time until the internal reaper reaps the subprocess.
Clock::pause();
- while (s.get().status().isPending()) {
+ while (s->status().isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
Clock::resume();
- AWAIT_EXPECT_WTERMSIG_EQ(SIGTERM, s.get().status());
+ AWAIT_EXPECT_WTERMSIG_EQ(SIGTERM, s->status());
// SIGKILL.
s = subprocess(SLEEP_COMMAND(60));
ASSERT_SOME(s);
- kill(s.get().pid(), SIGKILL);
+ kill(s->pid(), SIGKILL);
// Advance time until the internal reaper reaps the subprocess.
Clock::pause();
- while (s.get().status().isPending()) {
+ while (s->status().isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
Clock::resume();
- AWAIT_EXPECT_WTERMSIG_EQ(SIGKILL, s.get().status());
+ AWAIT_EXPECT_WTERMSIG_EQ(SIGKILL, s->status());
}
@@ -309,18 +309,18 @@ TEST_F(SubprocessTest, PipeOutput)
Subprocess::FD(STDERR_FILENO));
ASSERT_SOME(s);
- ASSERT_SOME(s.get().out());
- AWAIT_EXPECT_EQ("hello\n", io::read(s.get().out().get()));
+ ASSERT_SOME(s->out());
+ AWAIT_EXPECT_EQ("hello\n", io::read(s->out().get()));
// Advance time until the internal reaper reaps the subprocess.
Clock::pause();
- while (s.get().status().isPending()) {
+ while (s->status().isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
Clock::resume();
- AWAIT_EXPECT_WEXITSTATUS_EQ(0, s.get().status());
+ AWAIT_EXPECT_WEXITSTATUS_EQ(0, s->status());
// Standard error.
s = subprocess(
@@ -330,18 +330,18 @@ TEST_F(SubprocessTest, PipeOutput)
Subprocess::PIPE());
ASSERT_SOME(s);
- ASSERT_SOME(s.get().err());
- AWAIT_EXPECT_EQ("hello\n", io::read(s.get().err().get()));
+ ASSERT_SOME(s->err());
+ AWAIT_EXPECT_EQ("hello\n", io::read(s->err().get()));
// Advance time until the internal reaper reaps the subprocess.
Clock::pause();
- while (s.get().status().isPending()) {
+ while (s->status().isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
Clock::resume();
- AWAIT_EXPECT_WEXITSTATUS_EQ(0, s.get().status());
+ AWAIT_EXPECT_WEXITSTATUS_EQ(0, s->status());
}
@@ -354,21 +354,21 @@ TEST_F(SubprocessTest, PipeInput)
Subprocess::FD(STDERR_FILENO));
ASSERT_SOME(s);
- ASSERT_SOME(s.get().in());
- ASSERT_SOME(os::write(s.get().in().get(), "hello\n"));
+ ASSERT_SOME(s->in());
+ ASSERT_SOME(os::write(s->in().get(), "hello\n"));
- ASSERT_SOME(s.get().out());
- AWAIT_EXPECT_EQ("hello\n", io::read(s.get().out().get()));
+ ASSERT_SOME(s->out());
+ AWAIT_EXPECT_EQ("hello\n", io::read(s->out().get()));
// Advance time until the internal reaper reaps the subprocess.
Clock::pause();
- while (s.get().status().isPending()) {
+ while (s->status().isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
Clock::resume();
- AWAIT_EXPECT_WEXITSTATUS_EQ(0, s.get().status());
+ AWAIT_EXPECT_WEXITSTATUS_EQ(0, s->status());
}
@@ -393,22 +393,22 @@ TEST_F(SubprocessTest, PipeRedirect)
ASSERT_SOME(fd);
ASSERT_SOME(os::nonblock(fd.get()));
- ASSERT_SOME(s.get().out());
- ASSERT_SOME(os::nonblock(s.get().out().get()));
- AWAIT_READY(io::redirect(s.get().out().get(), fd.get()));
+ ASSERT_SOME(s->out());
+ ASSERT_SOME(os::nonblock(s->out().get()));
+ AWAIT_READY(io::redirect(s->out().get(), fd.get()));
// Close our copy of the fd.
EXPECT_SOME(os::close(fd.get()));
// Advance time until the internal reaper reaps the subprocess.
Clock::pause();
- while (s.get().status().isPending()) {
+ while (s->status().isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
Clock::resume();
- AWAIT_EXPECT_WEXITSTATUS_EQ(0, s.get().status());
+ AWAIT_EXPECT_WEXITSTATUS_EQ(0, s->status());
// Now make sure all the data is there!
Try<string> read = os::read(path);
@@ -433,13 +433,13 @@ TEST_F(SubprocessTest, PathOutput)
// Advance time until the internal reaper reaps the subprocess.
Clock::pause();
- while (s.get().status().isPending()) {
+ while (s->status().isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
Clock::resume();
- AWAIT_EXPECT_WEXITSTATUS_EQ(0, s.get().status());
+ AWAIT_EXPECT_WEXITSTATUS_EQ(0, s->status());
Try<string> read = os::read(out);
ASSERT_SOME(read);
@@ -456,13 +456,13 @@ TEST_F(SubprocessTest, PathOutput)
// Advance time until the internal reaper reaps the subprocess.
Clock::pause();
- while (s.get().status().isPending()) {
+ while (s->status().isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
Clock::resume();
- AWAIT_EXPECT_WEXITSTATUS_EQ(0, s.get().status());
+ AWAIT_EXPECT_WEXITSTATUS_EQ(0, s->status());
read = os::read(err);
ASSERT_SOME(read);
@@ -483,18 +483,18 @@ TEST_F(SubprocessTest, PathInput)
Subprocess::FD(STDERR_FILENO));
ASSERT_SOME(s);
- ASSERT_SOME(s.get().out());
- AWAIT_EXPECT_EQ("hello\n", io::read(s.get().out().get()));
+ ASSERT_SOME(s->out());
+ AWAIT_EXPECT_EQ("hello\n", io::read(s->out().get()));
// Advance time until the internal reaper reaps the subprocess.
Clock::pause();
- while (s.get().status().isPending()) {
+ while (s->status().isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
Clock::resume();
- AWAIT_EXPECT_WEXITSTATUS_EQ(0, s.get().status());
+ AWAIT_EXPECT_WEXITSTATUS_EQ(0, s->status());
}
@@ -522,13 +522,13 @@ TEST_F(SubprocessTest, FdOutput)
// Advance time until the internal reaper reaps the subprocess.
Clock::pause();
- while (s.get().status().isPending()) {
+ while (s->status().isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
Clock::resume();
- AWAIT_EXPECT_WEXITSTATUS_EQ(0, s.get().status());
+ AWAIT_EXPECT_WEXITSTATUS_EQ(0, s->status());
Try<string> read = os::read(out);
ASSERT_SOME(read);
@@ -553,13 +553,13 @@ TEST_F(SubprocessTest, FdOutput)
// Advance time until the internal reaper reaps the subprocess.
Clock::pause();
- while (s.get().status().isPending()) {
+ while (s->status().isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
Clock::resume();
- AWAIT_EXPECT_WEXITSTATUS_EQ(0, s.get().status());
+ AWAIT_EXPECT_WEXITSTATUS_EQ(0, s->status());
read = os::read(err);
ASSERT_SOME(read);
@@ -585,18 +585,18 @@ TEST_F(SubprocessTest, FdInput)
ASSERT_SOME(os::close(inFd.get()));
ASSERT_SOME(s);
- ASSERT_SOME(s.get().out());
- AWAIT_EXPECT_EQ("hello\n", io::read(s.get().out().get()));
+ ASSERT_SOME(s->out());
+ AWAIT_EXPECT_EQ("hello\n", io::read(s->out().get()));
// Advance time until the internal reaper reaps the subprocess.
Clock::pause();
- while (s.get().status().isPending()) {
+ while (s->status().isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
Clock::resume();
- AWAIT_EXPECT_WEXITSTATUS_EQ(0, s.get().status());
+ AWAIT_EXPECT_WEXITSTATUS_EQ(0, s->status());
}
@@ -608,13 +608,13 @@ TEST_F(SubprocessTest, Default)
// Advance time until the internal reaper reaps the subprocess.
Clock::pause();
- while (s.get().status().isPending()) {
+ while (s->status().isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
Clock::resume();
- AWAIT_EXPECT_WEXITSTATUS_EQ(0, s.get().status());
+ AWAIT_EXPECT_WEXITSTATUS_EQ(0, s->status());
}
#endif // __WINDOWS__
@@ -695,13 +695,13 @@ TEST_F(SubprocessTest, Flags)
// Advance time until the internal reaper reaps the subprocess.
Clock::pause();
- while (s.get().status().isPending()) {
+ while (s->status().isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
Clock::resume();
- AWAIT_EXPECT_WEXITSTATUS_EQ(0, s.get().status());
+ AWAIT_EXPECT_WEXITSTATUS_EQ(0, s->status());
// Parse the output and make sure that it matches the flags we
// specified in the beginning.
@@ -753,18 +753,18 @@ TEST_F(SubprocessTest, Environment)
environment);
ASSERT_SOME(s);
- ASSERT_SOME(s.get().out());
- AWAIT_EXPECT_EQ("hello\n", io::read(s.get().out().get()));
+ ASSERT_SOME(s->out());
+ AWAIT_EXPECT_EQ("hello\n", io::read(s->out().get()));
// Advance time until the internal reaper reaps the subprocess.
Clock::pause();
- while (s.get().status().isPending()) {
+ while (s->status().isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
Clock::resume();
- AWAIT_EXPECT_WEXITSTATUS_EQ(0, s.get().status());
+ AWAIT_EXPECT_WEXITSTATUS_EQ(0, s->status());
// Multiple key-value pairs.
environment.clear();
@@ -779,18 +779,18 @@ TEST_F(SubprocessTest, Environment)
environment);
ASSERT_SOME(s);
- ASSERT_SOME(s.get().out());
- AWAIT_EXPECT_EQ("hello world\n", io::read(s.get().out().get()));
+ ASSERT_SOME(s->out());
+ AWAIT_EXPECT_EQ("hello world\n", io::read(s->out().get()));
// Advance time until the internal reaper reaps the subprocess.
Clock::pause();
- while (s.get().status().isPending()) {
+ while (s->status().isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
Clock::resume();
- AWAIT_EXPECT_WEXITSTATUS_EQ(0, s.get().status());
+ AWAIT_EXPECT_WEXITSTATUS_EQ(0, s->status());
}
@@ -808,18 +808,18 @@ TEST_F(SubprocessTest, EnvironmentWithSpaces)
environment);
ASSERT_SOME(s);
- ASSERT_SOME(s.get().out());
- AWAIT_EXPECT_EQ("hello world\n", io::read(s.get().out().get()));
+ ASSERT_SOME(s->out());
+ AWAIT_EXPECT_EQ("hello world\n", io::read(s->out().get()));
// Advance time until the internal reaper reaps the subprocess.
Clock::pause();
- while (s.get().status().isPending()) {
+ while (s->status().isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
Clock::resume();
- AWAIT_EXPECT_WEXITSTATUS_EQ(0, s.get().status());
+ AWAIT_EXPECT_WEXITSTATUS_EQ(0, s->status());
}
@@ -837,18 +837,18 @@ TEST_F(SubprocessTest, EnvironmentWithSpacesAndQuotes)
environment);
ASSERT_SOME(s);
- ASSERT_SOME(s.get().out());
- AWAIT_EXPECT_EQ("\"hello world\"\n", io::read(s.get().out().get()));
+ ASSERT_SOME(s->out());
+ AWAIT_EXPECT_EQ("\"hello world\"\n", io::read(s->out().get()));
// Advance time until the internal reaper reaps the subprocess.
Clock::pause();
- while (s.get().status().isPending()) {
+ while (s->status().isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
Clock::resume();
- AWAIT_EXPECT_WEXITSTATUS_EQ(0, s.get().status());
+ AWAIT_EXPECT_WEXITSTATUS_EQ(0, s->status());
}
@@ -869,18 +869,18 @@ TEST_F(SubprocessTest, EnvironmentOverride)
environment);
ASSERT_SOME(s);
- ASSERT_SOME(s.get().out());
- AWAIT_EXPECT_EQ("goodbye\n", io::read(s.get().out().get()));
+ ASSERT_SOME(s->out());
+ AWAIT_EXPECT_EQ("goodbye\n", io::read(s->out().get()));
// Advance time until the internal reaper reaps the subprocess.
Clock::pause();
- while (s.get().status().isPending()) {
+ while (s->status().isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
Clock::resume();
- AWAIT_EXPECT_WEXITSTATUS_EQ(0, s.get().status());
+ AWAIT_EXPECT_WEXITSTATUS_EQ(0, s->status());
}
#endif // __WINDOWS__
http://git-wip-us.apache.org/repos/asf/mesos/blob/0d96c616/3rdparty/libprocess/src/tests/system_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/system_tests.cpp b/3rdparty/libprocess/src/tests/system_tests.cpp
index 6beb973..17f2881 100644
--- a/3rdparty/libprocess/src/tests/system_tests.cpp
+++ b/3rdparty/libprocess/src/tests/system_tests.cpp
@@ -43,11 +43,9 @@ TEST(SystemTest, DISABLED_Metrics)
AWAIT_READY(response);
- EXPECT_SOME_EQ(
- "application/json",
- response.get().headers.get("Content-Type"));
+ EXPECT_SOME_EQ("application/json", response->headers.get("Content-Type"));
- Try<JSON::Object> parse = JSON::parse<JSON::Object>(response.get().body);
+ Try<JSON::Object> parse = JSON::parse<JSON::Object>(response->body);
ASSERT_SOME(parse);
JSON::Object stats = parse.get();
http://git-wip-us.apache.org/repos/asf/mesos/blob/0d96c616/3rdparty/libprocess/src/tests/timeseries_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/timeseries_tests.cpp b/3rdparty/libprocess/src/tests/timeseries_tests.cpp
index 4177fb6..381e646 100644
--- a/3rdparty/libprocess/src/tests/timeseries_tests.cpp
+++ b/3rdparty/libprocess/src/tests/timeseries_tests.cpp
@@ -49,7 +49,7 @@ TEST(TimeSeriesTest, Set)
const Option<TimeSeries<int>::Value> latest = series.latest();
ASSERT_SOME(latest);
- ASSERT_EQ(1, latest.get().data);
+ ASSERT_EQ(1, latest->data);
}