use userdata only to seed ami bootstrap env

This commit is contained in:
Abel Luck 2026-02-27 16:03:00 +01:00
parent 3be933f16b
commit a7aabdff51
3 changed files with 30 additions and 56 deletions

View file

@ -0,0 +1,18 @@
"""Unit tests for builder bootstrap user-data rendering."""
from nix_builder_autoscaler.bootstrap.userdata import render_userdata
def test_render_userdata_writes_bootstrap_env_inputs() -> None:
script = render_userdata("slot001", ssm_param="/nix-builder/ts-authkey")
assert "cat > /etc/nix-builder-bootstrap-env <<EOF" in script
assert 'SLOT_ID="$SLOT_ID"' in script
assert 'TS_SSM_PARAM="$SSM_PARAM"' in script
assert "chmod 600 /etc/nix-builder-bootstrap-env" in script
def test_render_userdata_does_not_inline_tailscale_setup() -> None:
script = render_userdata("slot001", ssm_param="/nix-builder/ts-authkey")
assert "aws ssm get-parameter" not in script
assert "/etc/tailscale/autoconnect.conf" not in script
assert "TS_EXTRA_ARGS=" not in script