From 5634ada174c09767b2e60960d327f4b63180a117 Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Fri, 11 Nov 2022 15:52:13 -0800 Subject: [PATCH] Fix error caching models in integ test (#68) Fixes bug caching model load in integ test. This leads to a new model being loaded for each test. Now, only one model will be loaded, preventing CB exceptions. Signed-off-by: John Mazanec (cherry picked from commit 6068858e4a8633c4129db420f1f217c99df43e7e) --- .../org/opensearch/neuralsearch/query/NeuralQueryIT.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/opensearch/neuralsearch/query/NeuralQueryIT.java b/src/test/java/org/opensearch/neuralsearch/query/NeuralQueryIT.java index 9a4d3268e..ae62f308f 100644 --- a/src/test/java/org/opensearch/neuralsearch/query/NeuralQueryIT.java +++ b/src/test/java/org/opensearch/neuralsearch/query/NeuralQueryIT.java @@ -38,13 +38,15 @@ public class NeuralQueryIT extends BaseNeuralSearchIT { private static final int TEST_DIMENSION = 768; private static final SpaceType TEST_SPACE_TYPE = SpaceType.L2; + private static final AtomicReference modelId = new AtomicReference<>(); private final float[] testVector = createRandomVector(TEST_DIMENSION); - private final AtomicReference modelId = new AtomicReference<>(); @Before public void setUp() throws Exception { super.setUp(); - modelId.compareAndSet(null, prepareModel()); + if (modelId.get() == null) { + modelId.compareAndSet(null, prepareModel()); + } } /**