aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/tests/engine
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2019-03-12 20:25:33 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2019-03-13 09:39:29 +0000
commit64b3ff5093cedb87fc3672368a9c28ad4a787d57 (patch)
tree1f43c515c41250e5ed424b9c18a11aedc45b0045 /searchlib/src/tests/engine
parente572223ee498e58b5b6b69cd0dd00480029d3e82 (diff)
Make the Trace object itself lazy
Make start optional and explicit.
Diffstat (limited to 'searchlib/src/tests/engine')
-rw-r--r--searchlib/src/tests/engine/searchapi/searchapi_test.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/searchlib/src/tests/engine/searchapi/searchapi_test.cpp b/searchlib/src/tests/engine/searchapi/searchapi_test.cpp
index 2f2cf4f22e5..28c90dd18ca 100644
--- a/searchlib/src/tests/engine/searchapi/searchapi_test.cpp
+++ b/searchlib/src/tests/engine/searchapi/searchapi_test.cpp
@@ -228,36 +228,37 @@ TEST("convertFromReply") {
}
}
-void verify(vespalib::stringref expected, const vespalib::Slime & slime) {
+void verify(vespalib::stringref expected, const vespalib::Slime * slime) {
vespalib::Slime expectedSlime;
vespalib::slime::JsonFormat::decode(expected, expectedSlime);
- EXPECT_EQUAL(expectedSlime, slime);
+ if (slime) {
+ EXPECT_EQUAL(expectedSlime, *slime);
+ } else {
+ EXPECT_TRUE(expected.empty());
+ }
}
TEST("verify trace") {
RelativeTime clock(std::make_unique<CountingClock>(fastos::TimeStamp::fromSec(1500000000), 1700000L));
Trace t(clock);
- verify("{"
- " traces: ["
- " ],"
- " start_time_utc: '2017-07-14 02:40:00.000 UTC'"
- "}",
- t.getSlime());
+ verify("", t.getSlime());
+ t.start(0);
t.createCursor("tag_a");
verify("{"
+ " start_time_utc: '2017-07-14 02:40:00.000 UTC',"
" traces: ["
" {"
" tag: 'tag_a',"
" timestamp_ms: 1.7"
" }"
- " ],"
- " start_time_utc: '2017-07-14 02:40:00.000 UTC'"
+ " ]"
"}",
t.getSlime());
Trace::Cursor & tagB = t.createCursor("tag_b");
tagB.setLong("long", 19);
t.done();
verify("{"
+ " start_time_utc: '2017-07-14 02:40:00.000 UTC',"
" traces: ["
" {"
" tag: 'tag_a',"
@@ -269,7 +270,6 @@ TEST("verify trace") {
" long: 19"
" }"
" ],"
- " start_time_utc: '2017-07-14 02:40:00.000 UTC',"
" duration_ms: 5.1"
"}",
t.getSlime());