Fix: failing p3 test for SDK/HTTP APIs (#13062)

### What problem does this PR solve?

Adjust highlight parsing, add row-count SQL override, tweak retrieval
thresholding, and update tests with engine-aware skips/utilities.

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
6ba3i
2026-02-09 14:56:10 +08:00
committed by GitHub
parent ba95167e13
commit fabbfcab90
10 changed files with 110 additions and 12 deletions

View File

@@ -18,6 +18,7 @@ from concurrent.futures import ThreadPoolExecutor, as_completed
import pytest
from common import batch_add_chunks
from utils.engine_utils import get_doc_engine
class TestChunksList:
@@ -84,6 +85,12 @@ class TestChunksList:
)
def test_keywords(self, add_chunks, params, expected_page_size):
_, document, _ = add_chunks
if params.get("keywords") == "ragflow":
doc_engine = get_doc_engine(document.rag)
if doc_engine == "infinity" and expected_page_size == 1:
pytest.skip("issues/6509")
if doc_engine != "infinity" and expected_page_size == 5:
pytest.skip("issues/6509")
chunks = document.list_chunks(**params)
assert len(chunks) == expected_page_size, str(chunks)
@@ -99,6 +106,8 @@ class TestChunksList:
)
def test_id(self, add_chunks, chunk_id, expected_page_size, expected_message):
_, document, chunks = add_chunks
if callable(chunk_id) and get_doc_engine(document.rag) == "infinity":
pytest.skip("issues/6499")
chunk_ids = [chunk.id for chunk in chunks]
if callable(chunk_id):
params = {"id": chunk_id(chunk_ids)}

View File

@@ -18,6 +18,8 @@ from concurrent.futures import ThreadPoolExecutor, as_completed
import pytest
DOC_ENGINE = (os.getenv("DOC_ENGINE") or "").lower()
class TestChunksRetrieval:
@pytest.mark.p1
@@ -159,25 +161,25 @@ class TestChunksRetrieval:
{"top_k": 1},
4,
"",
marks=pytest.mark.skipif(os.getenv("DOC_ENGINE") in ["infinity", "opensearch"], reason="Infinity"),
marks=pytest.mark.skipif(DOC_ENGINE in ["infinity", "opensearch"], reason="Infinity"),
),
pytest.param(
{"top_k": 1},
1,
"",
marks=pytest.mark.skipif(os.getenv("DOC_ENGINE") in [None, "opensearch", "elasticsearch"], reason="elasticsearch"),
marks=pytest.mark.skipif(DOC_ENGINE in ["", "opensearch", "elasticsearch"], reason="elasticsearch"),
),
pytest.param(
{"top_k": -1},
4,
"must be greater than 0",
marks=pytest.mark.skipif(os.getenv("DOC_ENGINE") in ["infinity", "opensearch"], reason="Infinity"),
marks=pytest.mark.skipif(DOC_ENGINE in ["infinity", "opensearch"], reason="Infinity"),
),
pytest.param(
{"top_k": -1},
4,
"3014",
marks=pytest.mark.skipif(os.getenv("DOC_ENGINE") in [None, "opensearch", "elasticsearch"], reason="elasticsearch"),
marks=pytest.mark.skipif(DOC_ENGINE in ["", "opensearch", "elasticsearch"], reason="elasticsearch"),
),
pytest.param(
{"top_k": "a"},

View File

@@ -25,6 +25,7 @@ from utils import encode_avatar
from utils.file_utils import create_image_file
from utils.hypothesis_utils import valid_names
from configs import DEFAULT_PARSER_CONFIG
from utils.engine_utils import get_doc_engine
class TestRquest:
@pytest.mark.p2
@@ -332,6 +333,8 @@ class TestDatasetUpdate:
@pytest.mark.p2
@pytest.mark.parametrize("pagerank", [0, 50, 100], ids=["min", "mid", "max"])
def test_pagerank(self, client, add_dataset_func, pagerank):
if get_doc_engine(client) == "infinity":
pytest.skip("#8208")
dataset = add_dataset_func
dataset.update({"pagerank": pagerank})
assert dataset.pagerank == pagerank, str(dataset)
@@ -342,6 +345,8 @@ class TestDatasetUpdate:
@pytest.mark.skipif(os.getenv("DOC_ENGINE") == "infinity", reason="#8208")
@pytest.mark.p2
def test_pagerank_set_to_0(self, client, add_dataset_func):
if get_doc_engine(client) == "infinity":
pytest.skip("#8208")
dataset = add_dataset_func
dataset.update({"pagerank": 50})
assert dataset.pagerank == 50, str(dataset)
@@ -358,6 +363,8 @@ class TestDatasetUpdate:
@pytest.mark.skipif(os.getenv("DOC_ENGINE") != "infinity", reason="#8208")
@pytest.mark.p2
def test_pagerank_infinity(self, client, add_dataset_func):
if get_doc_engine(client) != "infinity":
pytest.skip("#8208")
dataset = add_dataset_func
with pytest.raises(Exception) as exception_info:
dataset.update({"pagerank": 50})

View File

@@ -81,6 +81,7 @@ class TestMemoryCreate:
@pytest.mark.p2
@given(name=valid_names())
@settings(deadline=None)
def test_type_invalid(self, client, name):
payload = {
"name": name,

View File

@@ -19,6 +19,7 @@ import random
import pytest
from ragflow_sdk import RAGFlow, Memory
from configs import INVALID_API_TOKEN, HOST_ADDRESS
from utils.engine_utils import get_doc_engine
class TestAuthorization:
@@ -88,6 +89,8 @@ class TestMessageList:
@pytest.mark.p2
@pytest.mark.skipif(os.getenv("DOC_ENGINE") == "infinity", reason="Not support.")
def test_search_keyword(self, client):
if get_doc_engine(client) == "infinity":
pytest.skip("Not support.")
memory_id = self.memory_id
session_ids = self.session_ids
session_id = random.choice(session_ids)