"""keycloak — RESTORE overlay (Phase 1e HC3): data-integrity, assertion-only + additive.

ops.pre_restore deleted the marker realm (diverge from the backup); the orchestrator restored once
(generic tier asserted healthy/serving). This overlay ADDS: the marker realm returned (mariadb
restored to the backed-up state). Re-auths post-restore."""

import os
import sys

sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..", "runner"))
import kc_admin  # noqa: E402


def test_restore_returns_realm(live_app):
    tok = kc_admin.admin_token(live_app, kc_admin.admin_password(live_app))
    assert kc_admin.marker_realm_exists(live_app, tok), "restore did not bring back the realm"
