test(docker): read persisted configuration as UTF-8 on Windows
This commit is contained in:
1 parent
de8fbc3ad2
commit
3ab8082118
2 files changed
+5
-5
No files matched your search
@@ -75,7 +75,7 @@ def main() -> None:
|
|||||||
service["environment"].update(
|
service["environment"].update(
|
||||||
NANOBOT_WEB_TOKEN=secret, NANOBOT_API_KEY=secret,
|
NANOBOT_WEB_TOKEN=secret, NANOBOT_API_KEY=secret,
|
||||||
)
|
)
|
||||||
compose_path.write_text(json.dumps(config))
|
compose_path.write_text(json.dumps(config), encoding="utf-8")
|
||||||
try:
|
try:
|
||||||
onboard = run("run", "--rm", "--no-deps", "-T", "nanobot-cli", "onboard")
|
onboard = run("run", "--rm", "--no-deps", "-T", "nanobot-cli", "onboard")
|
||||||
assert "Overwrite?" not in onboard
|
assert "Overwrite?" not in onboard
|
||||||
@@ -92,7 +92,7 @@ def main() -> None:
|
|||||||
wait_for(webui + "/")
|
wait_for(webui + "/")
|
||||||
assert set(run("ps", "--services").split()) == {"nanobot-gateway", "nanobot-api"}
|
assert set(run("ps", "--services").split()) == {"nanobot-gateway", "nanobot-api"}
|
||||||
path = data / "config.json"
|
path = data / "config.json"
|
||||||
saved = json.loads(path.read_text())
|
saved = json.loads(path.read_text(encoding="utf-8"))
|
||||||
password = saved["channels"]["websocket"]["tokenIssueSecret"]
|
password = saved["channels"]["websocket"]["tokenIssueSecret"]
|
||||||
api_key = saved["api"]["apiKey"]
|
api_key = saved["api"]["apiKey"]
|
||||||
logs = run("logs", "--no-color")
|
logs = run("logs", "--no-color")
|
||||||
@@ -132,7 +132,7 @@ def main() -> None:
|
|||||||
service["environment"].update(
|
service["environment"].update(
|
||||||
NANOBOT_WEB_TOKEN="changed-env", NANOBOT_API_KEY="changed-env",
|
NANOBOT_WEB_TOKEN="changed-env", NANOBOT_API_KEY="changed-env",
|
||||||
)
|
)
|
||||||
compose_path.write_text(json.dumps(config))
|
compose_path.write_text(json.dumps(config), encoding="utf-8")
|
||||||
run("up", "-d", "--force-recreate", "nanobot-gateway")
|
run("up", "-d", "--force-recreate", "nanobot-gateway")
|
||||||
webui = endpoint("nanobot-gateway", 8765)
|
webui = endpoint("nanobot-gateway", 8765)
|
||||||
wait_for(webui + "/")
|
wait_for(webui + "/")
|
||||||
|
|||||||
@@ -47,9 +47,9 @@ def test_custom_secrets_survive_json_serialization(tmp_path, secret):
|
|||||||
def test_restart_preserves_user_settings_and_credentials(tmp_path):
|
def test_restart_preserves_user_settings_and_credentials(tmp_path):
|
||||||
path = tmp_path / "config.json"
|
path = tmp_path / "config.json"
|
||||||
assert _initialize(path, "original-web", "original-api").returncode == 0
|
assert _initialize(path, "original-web", "original-api").returncode == 0
|
||||||
data = json.loads(path.read_text())
|
data = json.loads(path.read_text(encoding="utf-8"))
|
||||||
data["providers"]["custom"] = {"apiKey": "provider-key", "apiBase": "http://model:8000/v1"}
|
data["providers"]["custom"] = {"apiKey": "provider-key", "apiBase": "http://model:8000/v1"}
|
||||||
path.write_text(json.dumps(data))
|
path.write_text(json.dumps(data), encoding="utf-8")
|
||||||
previous = path.read_bytes()
|
previous = path.read_bytes()
|
||||||
result = _initialize(path, "replacement-web", "replacement-api")
|
result = _initialize(path, "replacement-web", "replacement-api")
|
||||||
assert result.returncode == 0, result.stderr
|
assert result.returncode == 0, result.stderr
|
||||||
|
|||||||
Reference in new issue
Block a user