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.
This commit is contained in:
Predrag Knezevic
2024-11-01 18:12:59 +01:00
committed by timvisee
parent 6f23975e3e
commit ef9cbabb4c

View File

@@ -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,