Fix failing test.

This commit is contained in:
Kishore Nallan 2018-02-08 16:57:32 -08:00
parent d8f3b8da9e
commit dc9ff3033b
2 changed files with 6 additions and 7 deletions

View File

@ -4,10 +4,7 @@
class TypesenseTestEnvironment : public testing::Environment {
public:
virtual void SetUp() {
auto log_worker = g3::LogWorker::createLogWorker();
auto sink_handle = log_worker->addSink(std2::make_unique<ConsoleLoggingSink>(),
&ConsoleLoggingSink::ReceiveLogMessage);
g3::initializeLogging(log_worker.get());
}
virtual void TearDown() {

View File

@ -64,6 +64,8 @@ TEST(StoreTest, GetUpdatesSince) {
Store replica_store(replica_store_path);
rocksdb::DB* replica_db = replica_store._get_db_unsafe();
updates_op = primary_store.get_updates_since(0, 10);
for(const std::string & update: *updates_op.get()) {
// Do Base64 encoding and decoding as we would in the API layer
const std::string update_encoded = StringUtils::base64_encode(update);
@ -72,14 +74,14 @@ TEST(StoreTest, GetUpdatesSince) {
replica_db->Write(rocksdb::WriteOptions(), &write_batch);
}
delete updates_op.get();
std::string value;
for(auto i=1; i<=3; i++) {
replica_store.get(std::string("foo")+std::to_string(i), value);
ASSERT_EQ(std::string("bar")+std::to_string(i), value);
}
delete updates_op.get();
// Ensure that updates are limited to max_updates argument
updates_op = primary_store.get_updates_since(0, 10);
ASSERT_EQ(3, updates_op.get()->size());
@ -127,5 +129,5 @@ TEST(StoreTest, GetUpdateSinceInvalidIterator) {
Option<std::vector<std::string>*> updates_op = primary_store.get_updates_since(2, 10);
ASSERT_FALSE(updates_op.ok());
ASSERT_EQ("Invalid iterator. Master's latest sequence number is 4 but updates are requested from sequence number 2. "
"The master's WAL entries might have expired (they are kept only for 24 hours).", updates_op.error());
"The master's WAL entries might have expired (they are kept only for 24 hours).", updates_op.error());
}