From ef9cbabb4c4e3325dc56e986b032b0fc5aa1b288 Mon Sep 17 00:00:00 2001 From: Predrag Knezevic Date: Fri, 1 Nov 2024 18:12:59 +0100 Subject: [PATCH] Add wait=true in openapi test for all point delete calls transparently (#5348) If `wait=true` param is not set for delete vector API calls, a test asserting later that data are gonna can become flaky, because at the assertion time the data could be still there. The following files contain such tests at the moment: * `test_multi_vector_uint8.py` * `test_multi_vector.py` * `test_multi_vector_unnamed.py` * `test_optional_vectors.py` In order to fix these and prevent the flakiness of future test, `request_with_validation` helper add `wait=true` param, if it is not set for delete vector calls. --- tests/openapi/helpers/helpers.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/openapi/helpers/helpers.py b/tests/openapi/helpers/helpers.py index 388132f89f..6bbb233336 100644 --- a/tests/openapi/helpers/helpers.py +++ b/tests/openapi/helpers/helpers.py @@ -1,7 +1,9 @@ import json +from logging import warning from typing import Any, Dict, List import jsonschema import requests +import warnings from schemathesis.models import APIOperation from schemathesis.specs.openapi.references import ConvertingResolver from schemathesis.specs.openapi.schemas import OpenApi30 @@ -75,6 +77,10 @@ def request_with_validation( if not action: raise RuntimeError(f"Method {method} does not exists") + if api.endswith("/delete") and method == "POST" and "wait" not in query_params: + warnings.warn(f"Delete call for {api} missing wait=true param, adding it") + query_params["wait"] = "true" + response = action( url=get_api_string(QDRANT_HOST, api, path_params), params=query_params,