Skip to content

Commit a4934ed

Browse files
author
s.kazemi
committed
fix: elastic test issue
1 parent 2197750 commit a4934ed

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

features/steps/elastic_adapter_steps.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,16 @@ async def step_create_index(context: Context, index_name: str, shards: str, repl
374374
index_body = {"settings": {"number_of_shards": int(shards), "number_of_replicas": int(replicas)}}
375375
actual_index_name = get_actual_index_name(context, index_name)
376376

377+
# If no mapping exists, create a unique name
378+
if actual_index_name == index_name:
379+
unique_suffix = str(uuid.uuid4())[:8]
380+
actual_index_name = f"{index_name}-{unique_suffix}"
381+
382+
# Store the mapping for other steps to use
383+
index_name_mapping = scenario_context.get("index_name_mapping", {})
384+
index_name_mapping[index_name] = actual_index_name
385+
scenario_context.store("index_name_mapping", index_name_mapping)
386+
377387
if is_async:
378388
result = await adapter.create_index(index=actual_index_name, body=index_body)
379389
else:

0 commit comments

Comments
 (0)