aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/tests/proton/matching/index_environment/index_environment_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'searchcore/src/tests/proton/matching/index_environment/index_environment_test.cpp')
-rw-r--r--searchcore/src/tests/proton/matching/index_environment/index_environment_test.cpp15
1 files changed, 14 insertions, 1 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(); }