mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-10-26 13:16:24 +00:00
test(channels): skip the POSIX-bound mode assertions on Windows hosts (#6257)
The channel runtime config store's atomic 0o600-temp + replace + chmod cannot land a POSIX mode on Windows, where chmod is a no-op approximation. Skip the two POSIX-bound tests and guard the trailing mode assertion of the chmod-failure test, keeping its platform- independent log-behavior coverage everywhere. Fixes #6256 Co-authored-by: xiaodu55 <xiaodu55@users.noreply.github.com>
This commit is contained in:
parent
68c7921a77
commit
a0b7679edf
@ -18,6 +18,7 @@ from __future__ import annotations
|
||||
import asyncio
|
||||
import importlib
|
||||
import logging
|
||||
import os
|
||||
from pathlib import Path
|
||||
from types import SimpleNamespace
|
||||
from unittest import mock
|
||||
@ -107,6 +108,7 @@ async def test_disconnect_runtime_channel_does_not_block_event_loop(tmp_path) ->
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.skipif(os.name == "nt", reason="chmod cannot express owner-only modes on Windows")
|
||||
async def test_runtime_config_store_file_is_owner_only(tmp_path) -> None:
|
||||
path = tmp_path / "channels" / "runtime-config.json"
|
||||
store = await asyncio.to_thread(ChannelRuntimeConfigStore, path)
|
||||
@ -121,6 +123,7 @@ async def test_runtime_config_store_file_is_owner_only(tmp_path) -> None:
|
||||
assert mode == 0o600
|
||||
|
||||
|
||||
@pytest.mark.skipif(os.name == "nt", reason="chmod cannot express owner-only modes on Windows")
|
||||
async def test_runtime_config_store_overwrites_loose_existing_file(tmp_path) -> None:
|
||||
"""A pre-existing world-readable file is tightened to 0o600 after a save.
|
||||
|
||||
@ -170,6 +173,7 @@ async def test_runtime_config_store_chmod_failure_is_logged_not_fatal(tmp_path,
|
||||
await asyncio.to_thread(_save_with_failing_temp_chmod)
|
||||
|
||||
assert any("Unable to chmod temporary channel runtime config store" in record.getMessage() for record in caplog.records)
|
||||
mode = await asyncio.to_thread(lambda: path.stat().st_mode & 0o777)
|
||||
assert mode == 0o600
|
||||
if os.name != "nt": # chmod cannot express owner-only modes on Windows
|
||||
mode = await asyncio.to_thread(lambda: path.stat().st_mode & 0o777)
|
||||
assert mode == 0o600
|
||||
assert await asyncio.to_thread(store.get_provider_config, "slack") == {"enabled": True, "bot_token": "xoxb-ui"}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user