diff options
author | Geir Storli <geirst@oath.com> | 2017-09-06 07:48:21 +0000 |
---|---|---|
committer | Geir Storli <geirst@oath.com> | 2017-09-06 15:45:25 +0000 |
commit | f77fff6223051fe8238eb5f9160348e422fe76f0 (patch) | |
tree | aa11461beccc20606584a7dd712efd96bec30c55 /searchcore/src/tests/proton/reference/document_db_reference_resolver | |
parent | 2b98bb212c745205d37666b3fdb9ad18243cb8fd (diff) |
Instantiate bit vector search cache in imported attribute vectors if visibility delay > 0.
Diffstat (limited to 'searchcore/src/tests/proton/reference/document_db_reference_resolver')
-rw-r--r-- | searchcore/src/tests/proton/reference/document_db_reference_resolver/document_db_reference_resolver_test.cpp | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/searchcore/src/tests/proton/reference/document_db_reference_resolver/document_db_reference_resolver_test.cpp b/searchcore/src/tests/proton/reference/document_db_reference_resolver/document_db_reference_resolver_test.cpp index 65e15a3efaa..a6576d11279 100644 --- a/searchcore/src/tests/proton/reference/document_db_reference_resolver/document_db_reference_resolver_test.cpp +++ b/searchcore/src/tests/proton/reference/document_db_reference_resolver/document_db_reference_resolver_test.cpp @@ -224,9 +224,12 @@ struct Fixture { oldAttrMgr.addReferenceAttribute("parent2_ref"); oldAttrMgr.addReferenceAttribute("parent3_ref"); } - ImportedAttributesRepo::UP resolve() { + ImportedAttributesRepo::UP resolve(fastos::TimeStamp visibilityDelay) { DocumentDBReferenceResolver resolver(registry, docModel.childDocType, importedFieldsCfg, docModel.childDocType, _gidToLidChangeListenerRefCount, _attributeFieldWriter); - return resolver.resolve(attrMgr, oldAttrMgr); + return resolver.resolve(attrMgr, oldAttrMgr, visibilityDelay); + } + ImportedAttributesRepo::UP resolve() { + return resolve(fastos::TimeStamp(0)); } void teardown() { DocumentDBReferenceResolver resolver(registry, docModel.childDocType, importedFieldsCfg, docModel.childDocType, _gidToLidChangeListenerRefCount, _attributeFieldWriter); @@ -238,11 +241,13 @@ struct Fixture { void assertImportedAttribute(const vespalib::string &name, const vespalib::string &referenceField, const vespalib::string &targetField, + bool useSearchCache, ImportedAttributeVector::SP attr) { ASSERT_TRUE(attr.get()); EXPECT_EQUAL(name, attr->getName()); EXPECT_EQUAL(attrMgr.getReferenceAttribute(referenceField), attr->getReferenceAttribute().get()); EXPECT_EQUAL(parentReference->getAttribute(targetField).get(), attr->getTargetAttribute().get()); + EXPECT_EQUAL(useSearchCache, attr->getSearchCache().get() != nullptr); } MockGidToLidChangeHandler &getGidToLidChangeHandler(const vespalib::string &referencedDocTypeName) { @@ -272,12 +277,20 @@ TEST_F("require that reference attributes are connected to gid mapper", Fixture) EXPECT_EQUAL(f.factory.get(), f.getMapperFactoryPtr("other_ref")); } -TEST_F("require that imported attributes are instantiated", Fixture) +TEST_F("require that imported attributes are instantiated without search cache as default", Fixture) { auto repo = f.resolve(); EXPECT_EQUAL(2u, repo->size()); - f.assertImportedAttribute("imported_a", "ref", "target_a", repo->get("imported_a")); - f.assertImportedAttribute("imported_b", "other_ref", "target_b", repo->get("imported_b")); + f.assertImportedAttribute("imported_a", "ref", "target_a", false, repo->get("imported_a")); + f.assertImportedAttribute("imported_b", "other_ref", "target_b", false, repo->get("imported_b")); +} + +TEST_F("require that imported attributes are instantiated with search cache if visibility delay > 0", Fixture) +{ + auto repo = f.resolve(fastos::TimeStamp::Seconds(1.0)); + EXPECT_EQUAL(2u, repo->size()); + f.assertImportedAttribute("imported_a", "ref", "target_a", true, repo->get("imported_a")); + f.assertImportedAttribute("imported_b", "other_ref", "target_b", true, repo->get("imported_b")); } TEST_F("require that listeners are added", Fixture) |