aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2021-11-12 14:04:32 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2021-11-12 14:06:04 +0000
commit854ecccb1ea9fbe2d1e1be4e9bbe234b6c1e60f7 (patch)
tree89d6a8b9976c4391ddbb6eed8b62243983638683 /searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp
parentf370d1e0a6a9fae3d0cb2b5240562f61703f25f7 (diff)
Test that up -> retired -> up is reflectd correctly in document subdbs.
Diffstat (limited to 'searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp')
-rw-r--r--searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp b/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp
index 60d5f57ac8c..bd356973841 100644
--- a/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp
@@ -305,7 +305,7 @@ struct FixtureBase
_bucketDBHandler(*_bucketDB),
_ctx(_writeService, _bucketDB, _bucketDBHandler),
_baseSchema(),
- _snapshot(new MyConfigSnapshot(_baseSchema, Traits::ConfigDir::dir())),
+ _snapshot(std::make_unique<MyConfigSnapshot>(_baseSchema, Traits::ConfigDir::dir())),
_baseDir(BASE_DIR + "/" + SUB_NAME, BASE_DIR),
_subDb(_cfg._cfg, _ctx._ctx),
_tmpFeedView()
@@ -557,6 +557,29 @@ TEST_F("require that attribute manager can be reconfigured", SearchableFixture)
requireThatAttributeManagerCanBeReconfigured(f);
}
+TEST_F("require that subdb reflect retirement", FastAccessFixture)
+{
+ search::CompactionStrategy cfg(0.1, 0.3);
+
+ EXPECT_FALSE(f._subDb.isNodeRetired());
+ auto unretired_cfg = f._subDb.computeCompactionStrategy(cfg);
+ EXPECT_TRUE(cfg == unretired_cfg);
+
+ auto calc = std::make_shared<proton::test::BucketStateCalculator>();
+ calc->setNodeRetired(true);
+ f._subDb.setBucketStateCalculator(calc);
+ EXPECT_TRUE(f._subDb.isNodeRetired());
+ auto retired_cfg = f._subDb.computeCompactionStrategy(cfg);
+ EXPECT_TRUE(cfg != retired_cfg);
+ EXPECT_TRUE(search::CompactionStrategy(0.5, 0.5) == retired_cfg);
+
+ calc->setNodeRetired(false);
+ f._subDb.setBucketStateCalculator(calc);
+ EXPECT_FALSE(f._subDb.isNodeRetired());
+ unretired_cfg = f._subDb.computeCompactionStrategy(cfg);
+ EXPECT_TRUE(cfg == unretired_cfg);
+}
+
template <typename Fixture>
void
requireThatReconfiguredAttributesAreAccessibleViaFeedView(Fixture &f)