aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2020-04-02 10:52:34 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2020-04-02 10:52:34 +0000
commit9c3b09bbdd2d3819ae2edb35b867d996daa4a744 (patch)
tree4f181b5ad0dffb7a802ecf78ee669ead37f6df69
parent676dc64e73f418be10ef4cee68b102068bbc5530 (diff)
Unify tests.
-rw-r--r--messagebus/src/tests/error/error.cpp12
-rw-r--r--messagebus_test/src/tests/error/error.cpp15
2 files changed, 13 insertions, 14 deletions
diff --git a/messagebus/src/tests/error/error.cpp b/messagebus/src/tests/error/error.cpp
index 6ac15ae4015..244efe0bf99 100644
--- a/messagebus/src/tests/error/error.cpp
+++ b/messagebus/src/tests/error/error.cpp
@@ -46,27 +46,27 @@ TEST("error_test") {
ASSERT_TRUE(pxyNet.waitSlobrok("test/dst/session"));
for (int i = 0; i < 5; i++) {
- ASSERT_TRUE(ss->send(SimpleMessage::UP(new SimpleMessage("test message")), "test").isAccepted());
+ ASSERT_TRUE(ss->send(std::make_unique<SimpleMessage>("test message"), "test").isAccepted());
Message::UP msg = pxy.getMessage();
- ASSERT_TRUE(msg.get() != 0);
+ ASSERT_TRUE(msg);
is->forward(std::move(msg));
msg = dst.getMessage();
- ASSERT_TRUE(msg.get() != 0);
- Reply::UP reply(new EmptyReply());
+ ASSERT_TRUE(msg);
+ Reply::UP reply = std::make_unique<EmptyReply>();
msg->swapState(*reply);
reply->addError(Error(ErrorCode::APP_FATAL_ERROR, "fatality"));
ds->reply(std::move(reply));
reply = pxy.getReply();
- ASSERT_TRUE(reply.get() != 0);
+ ASSERT_TRUE(reply);
ASSERT_EQUAL(reply->getNumErrors(), 1u);
EXPECT_EQUAL(reply->getError(0).getService(), "test/dst/session");
reply->addError(Error(ErrorCode::APP_FATAL_ERROR, "fatality"));
is->forward(std::move(reply));
reply = src.getReply();
- ASSERT_TRUE(reply.get() != 0);
+ ASSERT_TRUE(reply);
ASSERT_EQUAL(reply->getNumErrors(), 2u);
EXPECT_EQUAL(reply->getError(0).getService(), "test/dst/session");
EXPECT_EQUAL(reply->getError(1).getService(), "test/pxy/session");
diff --git a/messagebus_test/src/tests/error/error.cpp b/messagebus_test/src/tests/error/error.cpp
index e5749db452b..57f9c82389d 100644
--- a/messagebus_test/src/tests/error/error.cpp
+++ b/messagebus_test/src/tests/error/error.cpp
@@ -1,20 +1,18 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/log/log.h>
-LOG_SETUP("error_test");
+
#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/messagebus/testlib/slobrok.h>
#include <vespa/vespalib/util/stringfmt.h>
+#include <vespa/log/log.h>
+LOG_SETUP("error_test");
+
using namespace mbus;
using vespalib::make_string;
-TEST_SETUP(Test);
-int
-Test::Main()
-{
- TEST_INIT("error_test");
+TEST("error_test") {
Slobrok slobrok;
const std::string routing_template = TEST_PATH("routing-template.cfg");
const std::string ctl_script = TEST_PATH("ctl.sh");
@@ -44,5 +42,6 @@ Test::Main()
EXPECT_TRUE(system("../../binref/runjava JavaClient") == 0);
EXPECT_TRUE(system((ctl_script + " stop server java").c_str()) == 0);
}
- TEST_DONE();
}
+
+TEST_MAIN() { TEST_RUN_ALL(); }