diff options
author | Håvard Pettersen <havardpe@oath.com> | 2020-08-31 10:32:50 +0000 |
---|---|---|
committer | Håvard Pettersen <havardpe@oath.com> | 2020-09-01 12:45:13 +0000 |
commit | 3440f424ab11d8d8810b6f9785e6a8fad7271fe1 (patch) | |
tree | b769b0acf1485b4b18fd51efe556c8a6b583c7bf /searchcore/src/tests/proton/matching | |
parent | 3b8f7fdff4872bd010286753f6072ec492f14a48 (diff) |
handle onnx models config
Diffstat (limited to 'searchcore/src/tests/proton/matching')
-rw-r--r-- | searchcore/src/tests/proton/matching/index_environment/index_environment_test.cpp | 15 | ||||
-rw-r--r-- | searchcore/src/tests/proton/matching/matching_test.cpp | 2 |
2 files changed, 15 insertions, 2 deletions
diff --git a/searchcore/src/tests/proton/matching/index_environment/index_environment_test.cpp b/searchcore/src/tests/proton/matching/index_environment/index_environment_test.cpp index 932ab6f4d14..508a60480d0 100644 --- a/searchcore/src/tests/proton/matching/index_environment/index_environment_test.cpp +++ b/searchcore/src/tests/proton/matching/index_environment/index_environment_test.cpp @@ -14,6 +14,13 @@ using search::index::schema::DataType; using vespalib::eval::ConstantValue; using SIAF = Schema::ImportedAttributeField; +OnnxModels make_models() { + OnnxModels::Vector list; + list.emplace_back("model1", "path1"); + list.emplace_back("model2", "path2"); + return OnnxModels(list); +} + struct MyConstantValueRepo : public IConstantValueRepo { virtual ConstantValue::UP getConstant(const vespalib::string &) const override { return ConstantValue::UP(); @@ -42,7 +49,7 @@ struct Fixture { Fixture(Schema::UP schema_) : repo(), schema(std::move(schema_)), - env(7, *schema, Properties(), repo) + env(7, *schema, Properties(), repo, make_models()) { } const FieldInfo *assertField(size_t idx, @@ -97,4 +104,10 @@ TEST_F("require that imported attribute fields are extracted in index environmen EXPECT_EQUAL("[documentmetastore]", f.env.getField(2)->name()); } +TEST_F("require that onnx model paths can be obtained", Fixture(buildEmptySchema())) { + EXPECT_EQUAL(f1.env.getOnnxModelFullPath("model1").value(), vespalib::string("path1")); + EXPECT_EQUAL(f1.env.getOnnxModelFullPath("model2").value(), vespalib::string("path2")); + EXPECT_FALSE(f1.env.getOnnxModelFullPath("model3").has_value()); +} + TEST_MAIN() { TEST_RUN_ALL(); } diff --git a/searchcore/src/tests/proton/matching/matching_test.cpp b/searchcore/src/tests/proton/matching/matching_test.cpp index 9d5b67af81c..0ea63bce859 100644 --- a/searchcore/src/tests/proton/matching/matching_test.cpp +++ b/searchcore/src/tests/proton/matching/matching_test.cpp @@ -278,7 +278,7 @@ struct MyWorld { } Matcher::SP createMatcher() { - return std::make_shared<Matcher>(schema, config, clock, queryLimiter, constantValueRepo, 0); + return std::make_shared<Matcher>(schema, config, clock, queryLimiter, constantValueRepo, OnnxModels(), 0); } struct MySearchHandler : ISearchHandler { |