From b27655331f7c1f5ab59743738976a4537e780c09 Mon Sep 17 00:00:00 2001 From: Harald Musum Date: Fri, 11 Feb 2022 09:13:07 +0100 Subject: Skip tests if onnxruntime unavailable --- .../java/com/yahoo/vespa/model/container/ml/ModelsEvaluatorTest.java | 3 +++ .../src/test/java/com/yahoo/vespa/model/ml/ModelEvaluationTest.java | 3 +++ .../java/com/yahoo/vespa/model/ml/StatelessOnnxEvaluationTest.java | 5 ++++- 3 files changed, 10 insertions(+), 1 deletion(-) (limited to 'config-model') diff --git a/config-model/src/test/java/com/yahoo/vespa/model/container/ml/ModelsEvaluatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/container/ml/ModelsEvaluatorTest.java index 5630d3cc186..f246b87d9bf 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/container/ml/ModelsEvaluatorTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/container/ml/ModelsEvaluatorTest.java @@ -1,12 +1,14 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.model.container.ml; +import ai.vespa.modelintegration.evaluator.OnnxEvaluator; import ai.vespa.models.evaluation.FunctionEvaluator; import ai.vespa.models.evaluation.ModelsEvaluator; import com.yahoo.tensor.Tensor; import org.junit.Test; import static org.junit.Assert.assertEquals; +import static org.junit.Assume.assumeTrue; /** * Tests the ModelsEvaluatorTester. @@ -17,6 +19,7 @@ public class ModelsEvaluatorTest { @Test public void testModelsEvaluatorTester() { + assumeTrue(OnnxEvaluator.isRuntimeAvailable()); ModelsEvaluator modelsEvaluator = ModelsEvaluatorTester.create("src/test/cfg/application/stateless_eval"); assertEquals(3, modelsEvaluator.models().size()); diff --git a/config-model/src/test/java/com/yahoo/vespa/model/ml/ModelEvaluationTest.java b/config-model/src/test/java/com/yahoo/vespa/model/ml/ModelEvaluationTest.java index 7627ba6319b..c60817704cd 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/ml/ModelEvaluationTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/ml/ModelEvaluationTest.java @@ -1,6 +1,7 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.model.ml; +import ai.vespa.modelintegration.evaluator.OnnxEvaluator; import ai.vespa.models.evaluation.Model; import ai.vespa.models.evaluation.ModelsEvaluator; import ai.vespa.models.handler.ModelsEvaluationHandler; @@ -30,6 +31,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; +import static org.junit.Assume.assumeTrue; /** * Tests stateless model evaluation (turned on by the "model-evaluation" tag in "container") @@ -61,6 +63,7 @@ public class ModelEvaluationTest { @Test public void testMl_serving() throws IOException { + assumeTrue(OnnxEvaluator.isRuntimeAvailable()); Path appDir = Path.fromString("src/test/cfg/application/ml_serving"); Path storedAppDir = appDir.append("copy"); try { diff --git a/config-model/src/test/java/com/yahoo/vespa/model/ml/StatelessOnnxEvaluationTest.java b/config-model/src/test/java/com/yahoo/vespa/model/ml/StatelessOnnxEvaluationTest.java index 6e096dd68e4..7372e871e5d 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/ml/StatelessOnnxEvaluationTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/ml/StatelessOnnxEvaluationTest.java @@ -1,6 +1,7 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.model.ml; +import ai.vespa.modelintegration.evaluator.OnnxEvaluator; import ai.vespa.models.evaluation.FunctionEvaluator; import ai.vespa.models.evaluation.Model; import ai.vespa.models.evaluation.ModelsEvaluator; @@ -29,6 +30,7 @@ import java.util.stream.Collectors; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; +import static org.junit.Assume.assumeTrue; /** * Tests stateless model evaluation (turned on by the "model-evaluation" tag in "container") @@ -39,7 +41,8 @@ import static org.junit.Assert.assertTrue; public class StatelessOnnxEvaluationTest { @Test - public void testStatelessOnnxModelNameCollision() throws IOException { + public void testStatelessOnnxModelNameCollision() { + assumeTrue(OnnxEvaluator.isRuntimeAvailable()); Path appDir = Path.fromString("src/test/cfg/application/onnx_name_collision"); try { ImportedModelTester tester = new ImportedModelTester("onnx", appDir); -- cgit v1.2.3