diff options
author | Tor Egge <Tor.Egge@yahoo-inc.com> | 2017-05-05 12:25:49 +0000 |
---|---|---|
committer | Tor Egge <Tor.Egge@yahoo-inc.com> | 2017-05-05 12:25:49 +0000 |
commit | 933d073a97e6ab3731678a97551487e6eae1cc03 (patch) | |
tree | 62c9c19c116be8f3e1a03761020129352923dda6 /searchcore | |
parent | 44df619d2a1ab78c32f4600599d2027c317c4db7 (diff) |
Check that attribute write changes if document type repo changes.
Diffstat (limited to 'searchcore')
-rw-r--r-- | searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp b/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp index 0b4d101a6f3..a531e2d07de 100644 --- a/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp +++ b/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp @@ -533,6 +533,35 @@ TEST_F("require that we can reconfigure attribute manager", Fixture) EXPECT_TRUE(asAttributeManager(f._views.getViewPtrs().fv.get()->getAttributeWriter()->getAttributeManager())->getImportedAttributes() != nullptr); } +AttributeWriter::SP +getAttributeWriter(Fixture &f) +{ + return f._views.feedView.get()->getAttributeWriter(); +} + +void +checkAttributeWriterChangeOnRepoChange(Fixture &f, bool docTypeRepoChanged) +{ + auto oldAttributeWriter = getAttributeWriter(f); + AttributeCollectionSpec::AttributeList specList; + AttributeCollectionSpec spec(specList, 1, 0); + ReconfigParams params(CCR().setDocumentTypeRepoChanged(docTypeRepoChanged)); + // Use new config snapshot == old config snapshot (only relevant for reprocessing) + f._configurer->reconfigure(*createConfig(), *createConfig(), spec, params, f._resolver); + auto newAttributeWriter = getAttributeWriter(f); + if (docTypeRepoChanged) { + EXPECT_NOT_EQUAL(oldAttributeWriter, newAttributeWriter); + } else { + EXPECT_EQUAL(oldAttributeWriter, newAttributeWriter); + } +} + +TEST_F("require that we get new attribute writer if document type repo changes", Fixture) +{ + checkAttributeWriterChangeOnRepoChange(f, false); + checkAttributeWriterChangeOnRepoChange(f, true); +} + TEST_F("require that reconfigure returns reprocessing initializer when changing attributes", Fixture) { AttributeCollectionSpec::AttributeList specList; |