1 # This test verifies that the amazon-init service can treat the `user-data` ec2
2 # metadata file as a shell script. If amazon-init detects that `user-data` is a
3 # script (based on the presence of the shebang #! line) it executes it and
5 # Note that other tests verify that amazon-init can treat user-data as a nixos
6 # configuration expression.
8 { system ? builtins.currentSystem,
10 pkgs ? import ../.. { inherit system config; }
13 with import ../lib/testing-python.nix { inherit system pkgs; };
18 meta = with maintainers; {
19 maintainers = [ urbas ];
21 nodes.machine = { ... }:
23 imports = [ ../modules/profiles/headless.nix ../modules/virtualisation/amazon-init.nix ];
24 services.openssh.enable = true;
25 networking.hostName = "";
26 environment.etc."ec2-metadata/user-data" = {
30 echo successful > /tmp/evidence
35 # To wait until amazon-init terminates its run
36 unnamed.wait_for_unit("amazon-init.service")
38 unnamed.succeed("grep -q successful /tmp/evidence")