fix: prepare secrets from pinned La Suite Docs base
continuous-integration/drone/push Build is failing
continuous-integration/drone/push Build is failing
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
"""Pinned base recipes need the secret versions declared by their own tag."""
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..", "runner"))
|
||||
from harness import abra # noqa: E402
|
||||
|
||||
|
||||
def test_pinned_base_adds_removed_secret_without_overwriting_existing_version(
|
||||
monkeypatch, tmp_path
|
||||
):
|
||||
monkeypatch.setenv("HOME", str(tmp_path))
|
||||
monkeypatch.setenv("ABRA_DIR", str(tmp_path / ".abra"))
|
||||
recipe = tmp_path / ".abra" / "recipes" / "lasuite-docs"
|
||||
recipe.mkdir(parents=True)
|
||||
(recipe / ".env.sample").write_text(
|
||||
"SECRET_COLLAB_SS_VERSION=v1\n"
|
||||
"SECRET_JWT_PK_VERSION=v1 # generate=false\n"
|
||||
"# SECRET_UNUSED_VERSION=v1\n"
|
||||
)
|
||||
env = tmp_path / ".abra" / "servers" / "default" / "test.example.env"
|
||||
env.parent.mkdir(parents=True)
|
||||
env.write_text("SECRET_JWT_PK_VERSION=v2\n")
|
||||
|
||||
abra.ensure_secret_versions_from_recipe("lasuite-docs", "test.example")
|
||||
|
||||
assert abra.env_get("test.example", "SECRET_COLLAB_SS_VERSION") == "v1"
|
||||
assert abra.env_get("test.example", "SECRET_JWT_PK_VERSION") == "v2"
|
||||
assert abra.env_get("test.example", "SECRET_UNUSED_VERSION") is None
|
||||
@@ -127,7 +127,13 @@ def test_previous_overlay_deploys_checked_out_base_without_clean_tree_gate(monke
|
||||
"prepull_images",
|
||||
):
|
||||
monkeypatch.setattr(lifecycle, name, lambda *a, **kw: None)
|
||||
for name in ("app_config_remove", "app_new", "env_set", "secret_generate"):
|
||||
for name in (
|
||||
"app_config_remove",
|
||||
"app_new",
|
||||
"env_set",
|
||||
"secret_generate",
|
||||
"ensure_secret_versions_from_recipe",
|
||||
):
|
||||
monkeypatch.setattr(lifecycle.abra, name, lambda *a, **kw: None)
|
||||
monkeypatch.setattr(lifecycle.meta_mod, "extra_env", lambda *a: {})
|
||||
monkeypatch.setattr(lifecycle.meta_mod, "hook_ctx", lambda *a: None)
|
||||
|
||||
Reference in New Issue
Block a user