nixos/tests/ec2: Fix test tooling

This change fixes two problems with the qemu testing code:
1. Previously, the qemu-img command was missing a disk image format
argument.
2. Previously, if a test assertion failed, the test hung because the VM
was not torn down.

Changed files
+8 -1
nixos
tests
common
+8 -1
nixos/tests/common/ec2.nix
···
ln -s ${pkgs.writeText "sshPublicKey" sshPublicKey} $out/1.0/meta-data/public-keys/0/openssh-key
'';
};
+
indentLines = str: concatLines (map (s: " " + s) (splitString "\n" str));
in makeTest {
name = "ec2-" + name;
nodes = {};
···
"qemu-img",
"create",
"-f",
+
"qcow2",
+
"-F",
"qcow2",
"-o",
"backing_file=${image}",
···
)
machine = create_machine({"startCommand": start_command})
-
'' + script;
+
try:
+
'' + indentLines script + ''
+
finally:
+
machine.shutdown()
+
'';
inherit meta;
};