nix-builder-autoscaler/agent/nix_builder_autoscaler/tests/test_bootstrap_userdata.py

18 lines
792 B
Python

"""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