fix: pin migration schema after role switch
Some checks failed
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / pytest-smoke (push) Failing after 2s

Assistant: codex
Assistant-Model: gpt-5.6-sol
Assistant-Session: 01a053ff-1d6f-7fe2-ac1c-a6eb40a42a0c
This commit is contained in:
tegwick 2026-09-01 01:54:18 +02:00
parent f582773f5a
commit 2dcec7718c
3 changed files with 22 additions and 2 deletions

View file

@ -2,7 +2,7 @@ from __future__ import annotations
import pytest
from hub_core.migrations.roles import migration_role_statement
from hub_core.migrations.roles import migration_role_statement, migration_schema_statement
def test_migration_role_is_quoted_and_validated() -> None:
@ -10,3 +10,12 @@ def test_migration_role_is_quoted_and_validated() -> None:
assert migration_role_statement(None) is None
with pytest.raises(ValueError, match="safe PostgreSQL role"):
migration_role_statement('owner"; DROP SCHEMA public; --')
def test_migration_schema_is_explicitly_quoted_and_validated() -> None:
assert migration_schema_statement("hub_runtime") == (
'SET search_path TO "hub_runtime", public'
)
assert migration_schema_statement(None) is None
with pytest.raises(ValueError, match="safe PostgreSQL schema"):
migration_schema_statement('hub_runtime"; DROP SCHEMA public; --')