diff --git a/src/test/java/org/opensearch/neuralsearch/processor/TextImageEmbeddingProcessorIT.java b/src/test/java/org/opensearch/neuralsearch/processor/TextImageEmbeddingProcessorIT.java index c2bf16959..9d02fe09a 100644 --- a/src/test/java/org/opensearch/neuralsearch/processor/TextImageEmbeddingProcessorIT.java +++ b/src/test/java/org/opensearch/neuralsearch/processor/TextImageEmbeddingProcessorIT.java @@ -16,8 +16,11 @@ */ public class TextImageEmbeddingProcessorIT extends BaseNeuralSearchIT { - private static final String INDEX_NAME = "text_image_embedding_index"; - private static final String PIPELINE_NAME = "ingest-pipeline"; + private static final String INDEX_NAME_1 = "text_image_embedding_index-1"; + private static final String INDEX_NAME_2 = "text_image_embedding_index-2"; + private static final String FROM_INDEX_NAME = "test-reindex-from"; + private static final String PIPELINE_NAME_1 = "text_image_embedding_ingest_pipeline-1"; + private static final String PIPELINE_NAME_2 = "text_image_embedding_ingest_pipeline-2"; private static final String INGEST_DOCUMENT = "{\n" + " \"title\": \"This is a good day\",\n" + " \"description\": \"daily logging\",\n" @@ -45,16 +48,16 @@ public void testEmbeddingProcessor_whenIngestingDocumentWithOrWithoutSourceMatch try { modelId = uploadModel(); loadModel(modelId); - createPipelineProcessor(modelId, PIPELINE_NAME, ProcessorType.TEXT_IMAGE_EMBEDDING); - createIndexWithPipeline(INDEX_NAME, "IndexMappings.json", PIPELINE_NAME); + createPipelineProcessor(modelId, PIPELINE_NAME_1, ProcessorType.TEXT_IMAGE_EMBEDDING); + createIndexWithPipeline(INDEX_NAME_1, "IndexMappings.json", PIPELINE_NAME_1); // verify doc with mapping - ingestDocument(INDEX_NAME, INGEST_DOCUMENT); - assertEquals(1, getDocCount(INDEX_NAME)); + ingestDocument(INDEX_NAME_1, INGEST_DOCUMENT); + assertEquals(1, getDocCount(INDEX_NAME_1)); // verify doc without mapping - ingestDocument(INDEX_NAME, INGEST_DOCUMENT_UNMAPPED_FIELDS); - assertEquals(2, getDocCount(INDEX_NAME)); + ingestDocument(INDEX_NAME_1, INGEST_DOCUMENT_UNMAPPED_FIELDS); + assertEquals(2, getDocCount(INDEX_NAME_1)); } finally { - wipeOfTestResources(INDEX_NAME, PIPELINE_NAME, modelId, null); + wipeOfTestResources(INDEX_NAME_1, PIPELINE_NAME_1, modelId, null); } } @@ -65,20 +68,18 @@ private String uploadModel() throws Exception { public void testEmbeddingProcessor_whenReindexingDocument_thenSuccessful() throws Exception { // create a simple index and indexing data into this index. - String fromIndexName = "test-reindex-from"; - createIndexWithConfiguration(fromIndexName, "{ \"settings\": { \"number_of_shards\": 1, \"number_of_replicas\": 0 } }", null); - ingestDocument(fromIndexName, "{ \"text\": \"hello world\" }"); + createIndexWithConfiguration(FROM_INDEX_NAME, "{ \"settings\": { \"number_of_shards\": 1, \"number_of_replicas\": 0 } }", null); + ingestDocument(FROM_INDEX_NAME, "{ \"text\": \"hello world\" }"); String modelId = null; try { modelId = uploadModel(); loadModel(modelId); - String toIndexName = "test-reindex-to"; - createPipelineProcessor(modelId, PIPELINE_NAME, ProcessorType.TEXT_IMAGE_EMBEDDING); - createIndexWithPipeline(toIndexName, "IndexMappings.json", PIPELINE_NAME); - reindex(fromIndexName, toIndexName); - assertEquals(1, getDocCount(toIndexName)); + createPipelineProcessor(modelId, PIPELINE_NAME_2, ProcessorType.TEXT_IMAGE_EMBEDDING); + createIndexWithPipeline(INDEX_NAME_2, "IndexMappings.json", PIPELINE_NAME_2); + reindex(FROM_INDEX_NAME, INDEX_NAME_2); + assertEquals(1, getDocCount(INDEX_NAME_2)); } finally { - wipeOfTestResources(fromIndexName, PIPELINE_NAME, modelId, null); + wipeOfTestResources(INDEX_NAME_2, PIPELINE_NAME_2, modelId, null); } } }