Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions openviking/models/embedder/volcengine_embedders.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,6 @@ def __init__(
if self.api_base:
ark_kwargs["base_url"] = self.api_base
self.client = volcenginesdkarkruntime.Ark(**ark_kwargs)
self._ark_kwargs = ark_kwargs
self._async_client = None

def _update_telemetry_token_usage(self, response) -> None:
usage = getattr(response, "usage", None)
Expand Down
12 changes: 10 additions & 2 deletions tests/test_config_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@ def test_loads_existing_config(self, tmp_path):

def test_raises_on_missing(self, monkeypatch):
monkeypatch.delenv("TEST_MISSING_ENV", raising=False)
with pytest.raises(FileNotFoundError, match="configuration file not found"):
with pytest.raises(
FileNotFoundError,
match=r"(?s)configuration file not found.*https://openviking\.ai/docs",
):
require_config(None, "TEST_MISSING_ENV", "nonexistent_file.conf", "test")


Expand Down Expand Up @@ -199,6 +202,7 @@ def test_load_server_config_missing_message_uses_openviking_ai_docs(tmp_path, mo
monkeypatch.delenv("OPENVIKING_CONFIG_FILE", raising=False)
monkeypatch.setattr(server_config, "DEFAULT_CONFIG_DIR", tmp_path / "user")
monkeypatch.setattr(server_config, "SYSTEM_CONFIG_DIR", tmp_path / "system")
monkeypatch.setattr(server_config, "resolve_config_path", lambda *args, **kwargs: None)

with pytest.raises(FileNotFoundError, match=r"https://openviking\.ai/docs"):
server_config.load_server_config()
Expand All @@ -211,6 +215,7 @@ def test_openviking_config_singleton_missing_message_uses_openviking_ai_docs(tmp
monkeypatch.delenv("OPENVIKING_CONFIG_FILE", raising=False)
monkeypatch.setattr(config_module, "DEFAULT_CONFIG_DIR", tmp_path / "user")
monkeypatch.setattr(config_module, "SYSTEM_CONFIG_DIR", tmp_path / "system")
monkeypatch.setattr(config_module, "resolve_config_path", lambda *args, **kwargs: None)

OpenVikingConfigSingleton.reset_instance()
try:
Expand All @@ -220,13 +225,16 @@ def test_openviking_config_singleton_missing_message_uses_openviking_ai_docs(tmp
OpenVikingConfigSingleton.reset_instance()


def test_openviking_config_singleton_initialize_missing_message_uses_openviking_ai_docs(tmp_path, monkeypatch):
def test_openviking_config_singleton_initialize_missing_message_uses_openviking_ai_docs(
tmp_path, monkeypatch
):
import openviking_cli.utils.config.open_viking_config as config_module
from openviking_cli.utils.config.open_viking_config import OpenVikingConfigSingleton

monkeypatch.delenv("OPENVIKING_CONFIG_FILE", raising=False)
monkeypatch.setattr(config_module, "DEFAULT_CONFIG_DIR", tmp_path / "user")
monkeypatch.setattr(config_module, "SYSTEM_CONFIG_DIR", tmp_path / "system")
monkeypatch.setattr(config_module, "resolve_config_path", lambda *args, **kwargs: None)

OpenVikingConfigSingleton.reset_instance()
try:
Expand Down
8 changes: 8 additions & 0 deletions tests/test_server_config_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@
from openviking.server.config import load_server_config


def test_load_server_config_missing_file_points_to_current_docs(tmp_path, monkeypatch):
missing_config_path = tmp_path / "missing-config.json"
monkeypatch.setenv("OPENVIKING_CONFIG_FILE", str(missing_config_path))

with pytest.raises(FileNotFoundError, match=r"https://openviking\.ai/docs"):
load_server_config()


def test_load_server_config_rejects_unknown_field(tmp_path):
config_path = tmp_path / "ov.conf"
config_path.write_text(json.dumps({"server": {"host": "0.0.0.0", "prt": 9999}}))
Expand Down
Loading