Skip to content

Commit

Permalink
Read searchvisitor unit test config from source directory.
Browse files Browse the repository at this point in the history
  • Loading branch information
toregge committed Jun 18, 2024
1 parent abd5049 commit ac694d0
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions streamingvisitors/src/tests/searchvisitor/searchvisitor_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.h>
#include <vespa/storageframework/defaultimplementation/clock/fakeclock.h>
#include <vespa/vespalib/gtest/gtest.h>
#include <vespa/vespalib/testkit/test_path.h>

#include <vespa/log/log.h>
LOG_SETUP("searchvisitor_test");
Expand All @@ -30,6 +31,10 @@ vespalib::string get_doc_id(int id) {
return "id:test:test::" + std::to_string(id);
}

vespalib::string src_cfg(vespalib::stringref prefix, vespalib::stringref suffix) {
return prefix + TEST_PATH("cfg") + suffix;
}

/**
* This class reflects the document type defined in cfg/test.sd.
*/
Expand Down Expand Up @@ -160,9 +165,9 @@ class SearchVisitorTest : public testing::Test {

SearchVisitorTest::SearchVisitorTest() :
_componentRegister(),
_env(::config::ConfigUri("dir:cfg"), nullptr, ""),
_factory(::config::ConfigUri("dir:cfg"), nullptr, ""),
_repo(std::make_shared<DocumentTypeRepo>(readDocumenttypesConfig("cfg/documenttypes.cfg"))),
_env(::config::ConfigUri(src_cfg("dir:", "")), nullptr, ""),
_factory(::config::ConfigUri(src_cfg("dir:", "")), nullptr, ""),
_repo(std::make_shared<DocumentTypeRepo>(readDocumenttypesConfig(src_cfg("", "/documenttypes.cfg")))),
_doc_type(_repo->getDocumentType("test"))
{
assert(_doc_type != nullptr);
Expand Down

0 comments on commit ac694d0

Please sign in to comment.