mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-11-15 07:41:20 +00:00
Bundled examples keep their behavior tests in backend/tests/, so the core backend workflow ran optional extension behavior on every pull request. Mark those suites with pytest.mark.bundled_extension, exclude them from the core shards and from the duration baseline, and run them in a dedicated workflow through make test-bundled-extensions. Tests of host mechanisms stay in the core shards even when an example package is the payload. The marked suites import deerflow.agents, config, runtime, knowledge and app.gateway, so the workflow triggers for backend/packages/**, backend/app/gateway/** and the marked test modules; a backend test pins those paths, the make target and both marker selections, and fails when a marked module is missing from the path list. Host/extension compatibility checks — a host API gate and authorization of contributed routes — live in test_extension_host_contracts.py so they still fail core CI. The committed duration baseline drops the 482 entries for the excluded suites. Refs #8173 Co-authored-by: REI-330 <173389910+REI-330@users.noreply.github.com> Co-authored-by: willem-bd <143703838+willem-bd@users.noreply.github.com> Co-authored-by: Eilen6316 <136898293+Eilen6316@users.noreply.github.com>
41 lines
1.6 KiB
Python
41 lines
1.6 KiB
Python
"""The optional page must ship real assets without installing a second backend."""
|
|
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
from deerflow.extensions.loader import ExtensionSpec, load_extensions
|
|
|
|
pytestmark = pytest.mark.bundled_extension
|
|
|
|
|
|
@pytest.fixture
|
|
def load_center(monkeypatch):
|
|
monkeypatch.syspath_prepend(str(Path(__file__).resolve().parents[2] / "examples/deerflow-extension-knowledge-center"))
|
|
|
|
def load(config):
|
|
return load_extensions([ExtensionSpec(use="deerflow_extension_knowledge_center:install", config=config)])
|
|
|
|
return load
|
|
|
|
|
|
@pytest.mark.parametrize("enabled", [False, True])
|
|
def test_optional_center_has_packaged_page_and_no_management_backend(load_center, enabled):
|
|
loaded, diagnostics = load_center({"enabled": enabled})
|
|
assert not diagnostics
|
|
((_, plugin),) = loaded.plugins
|
|
assert plugin.namespace == "knowledge-center"
|
|
assert plugin.enabled is enabled
|
|
assert not plugin.backend and not plugin.tools and not loaded.routers
|
|
assets = plugin.frontend
|
|
assert assets.entry == "static/index.mjs"
|
|
assert set(assets.files) == {"static/index.mjs", "static/center.mjs", "static/styles.css", "static/copy.mjs"}
|
|
assert b"requestBackend" in assets.files["static/center.mjs"].content
|
|
|
|
|
|
@pytest.mark.parametrize("config", [{"enabled": "true"}, {"endpoint": "https://example.invalid"}, {"enabled": True, "token": "secret"}])
|
|
def test_page_config_cannot_introduce_credentials_or_provider_configuration(load_center, config):
|
|
loaded, diagnostics = load_center(config)
|
|
assert not loaded.plugins
|
|
assert diagnostics
|