aboutsummaryrefslogtreecommitdiffstats
path: root/storage/src/tests/common/hostreporter/versionreportertest.cpp
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@yahoo-inc.com>2016-06-15 23:09:44 +0200
committerJon Bratseth <bratseth@yahoo-inc.com>2016-06-15 23:09:44 +0200
commit72231250ed81e10d66bfe70701e64fa5fe50f712 (patch)
tree2728bba1131a6f6e5bdf95afec7d7ff9358dac50 /storage/src/tests/common/hostreporter/versionreportertest.cpp
Publish
Diffstat (limited to 'storage/src/tests/common/hostreporter/versionreportertest.cpp')
-rw-r--r--storage/src/tests/common/hostreporter/versionreportertest.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/storage/src/tests/common/hostreporter/versionreportertest.cpp b/storage/src/tests/common/hostreporter/versionreportertest.cpp
new file mode 100644
index 00000000000..43c6e64b0de
--- /dev/null
+++ b/storage/src/tests/common/hostreporter/versionreportertest.cpp
@@ -0,0 +1,39 @@
+// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+#include <vespa/fastos/fastos.h>
+#include <vespa/log/log.h>
+#include <vespa/storage/common/hostreporter/versionreporter.h>
+#include <vespa/vdstestlib/cppunit/macros.h>
+#include <vespa/vespalib/data/slime/slime.h>
+#include <vespa/vespalib/util/jsonstream.h>
+#include "util.h"
+
+LOG_SETUP(".test.versionreporter");
+
+namespace storage {
+namespace {
+using Object = vespalib::JsonStream::Object;
+using End = vespalib::JsonStream::End;
+}
+
+struct VersionReporterTest : public CppUnit::TestFixture
+{
+ void testVersionReporter();
+
+ CPPUNIT_TEST_SUITE(VersionReporterTest);
+ CPPUNIT_TEST(testVersionReporter);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(VersionReporterTest);
+
+void
+VersionReporterTest::testVersionReporter()
+{
+ VersionReporter versionReporter;
+ vespalib::Slime slime;
+ util::reporterToSlime(versionReporter, slime);
+ std::string version = slime.get()["vtag"]["version"].asString().make_string().c_str();
+ CPPUNIT_ASSERT(version.length() > 2);
+ CPPUNIT_ASSERT(version.find(".") > 0);
+}
+} // storage