summaryrefslogtreecommitdiffstats
path: root/searchcore/src/tests/proton/statusreport/statusreport_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'searchcore/src/tests/proton/statusreport/statusreport_test.cpp')
-rw-r--r--searchcore/src/tests/proton/statusreport/statusreport_test.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/searchcore/src/tests/proton/statusreport/statusreport_test.cpp b/searchcore/src/tests/proton/statusreport/statusreport_test.cpp
new file mode 100644
index 00000000000..10520912b2a
--- /dev/null
+++ b/searchcore/src/tests/proton/statusreport/statusreport_test.cpp
@@ -0,0 +1,41 @@
+// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/searchcore/proton/common/statusreport.h>
+
+namespace proton {
+
+TEST("require that default status report works")
+{
+ StatusReport sr(StatusReport::Params("foo"));
+
+ EXPECT_EQUAL("foo", sr.getComponent());
+ EXPECT_EQUAL(StatusReport::DOWN, sr.getState());
+ EXPECT_EQUAL("", sr.getInternalState());
+ EXPECT_EQUAL("", sr.getInternalConfigState());
+ EXPECT_FALSE(sr.hasProgress());
+ EXPECT_EQUAL("", sr.getMessage());
+ EXPECT_EQUAL("state=", sr.getInternalStatesStr());
+}
+
+TEST("require that custom status report works")
+{
+ StatusReport sr(StatusReport::Params("foo").
+ state(StatusReport::UPOK).
+ internalState("mystate").
+ internalConfigState("myconfigstate").
+ progress(65).
+ message("mymessage"));
+
+ EXPECT_EQUAL("foo", sr.getComponent());
+ EXPECT_EQUAL(StatusReport::UPOK, sr.getState());
+ EXPECT_EQUAL("mystate", sr.getInternalState());
+ EXPECT_EQUAL("myconfigstate", sr.getInternalConfigState());
+ EXPECT_TRUE(sr.hasProgress());
+ EXPECT_EQUAL(65, sr.getProgress());
+ EXPECT_EQUAL("mymessage", sr.getMessage());
+ EXPECT_EQUAL("state=mystate configstate=myconfigstate", sr.getInternalStatesStr());
+}
+
+} // namespace proton
+
+TEST_MAIN() { TEST_RUN_ALL(); }