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 2015/09/28 20:27:22 UTC
[08/10] mesos git commit: Improved streaming decoder tests by
checking the failed state.
Improved streaming decoder tests by checking the failed state.
Review: https://reviews.apache.org/r/38605
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/82fb36ac
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/82fb36ac
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/82fb36ac
Branch: refs/heads/master
Commit: 82fb36ac0b68eea0488aae1bca21b9a880b1e25e
Parents: 2bc6a19
Author: Benjamin Mahler <be...@gmail.com>
Authored: Mon Sep 21 11:26:54 2015 -0700
Committer: Benjamin Mahler <be...@gmail.com>
Committed: Mon Sep 28 11:09:55 2015 -0700
----------------------------------------------------------------------
3rdparty/libprocess/src/tests/decoder_tests.cpp | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/82fb36ac/3rdparty/libprocess/src/tests/decoder_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/decoder_tests.cpp b/3rdparty/libprocess/src/tests/decoder_tests.cpp
index 76eb80f..ab33126 100644
--- a/3rdparty/libprocess/src/tests/decoder_tests.cpp
+++ b/3rdparty/libprocess/src/tests/decoder_tests.cpp
@@ -162,7 +162,7 @@ TEST(DecoderTest, StreamingResponse)
const string body = "hi";
deque<Response*> responses = decoder.decode(headers.data(), headers.length());
- ASSERT_FALSE(decoder.failed());
+ EXPECT_FALSE(decoder.failed());
ASSERT_EQ(1, responses.size());
Response* response = responses[0];
@@ -178,9 +178,11 @@ TEST(DecoderTest, StreamingResponse)
EXPECT_TRUE(read.isPending());
decoder.decode(body.data(), body.length());
+ EXPECT_FALSE(decoder.failed());
// Feeding EOF to the decoder should be ok.
decoder.decode("", 0);
+ EXPECT_FALSE(decoder.failed());
EXPECT_TRUE(read.isReady());
EXPECT_EQ("hi", read.get());
@@ -207,9 +209,9 @@ TEST(DecoderTest, StreamingResponseFailure)
const string body = "1";
deque<Response*> responses = decoder.decode(headers.data(), headers.length());
- ASSERT_FALSE(decoder.failed());
- ASSERT_EQ(1, responses.size());
+ EXPECT_FALSE(decoder.failed());
+ ASSERT_EQ(1, responses.size());
Response* response = responses[0];
EXPECT_EQ("200 OK", response->status);
@@ -223,6 +225,7 @@ TEST(DecoderTest, StreamingResponseFailure)
EXPECT_TRUE(read.isPending());
decoder.decode(body.data(), body.length());
+ EXPECT_FALSE(decoder.failed());
EXPECT_TRUE(read.isReady());
EXPECT_EQ("1", read.get());
@@ -233,6 +236,7 @@ TEST(DecoderTest, StreamingResponseFailure)
// Feeding EOF to the decoder should trigger a failure!
decoder.decode("", 0);
+ EXPECT_TRUE(decoder.failed());
EXPECT_TRUE(read.isFailed());
EXPECT_EQ("failed to decode body", read.failure());