diff options
author | Andrew Childs <lorne@cons.org.nz> | 2020-01-13 02:40:44 +0900 |
---|---|---|
committer | Andrew Childs <lorne@cons.org.nz> | 2020-01-13 15:52:37 +0900 |
commit | e4fa8192da5269756ec225b99f9693e6e702c207 (patch) | |
tree | 48150ecf49a180c5dabaa6f7831891c469220c1c /nixos/tests/ec2.nix | |
parent | c2e5ff3fe8e1e57cfbde9a098f55c8b8c2531b83 (diff) | |
download | nixpkgs-e4fa8192da5269756ec225b99f9693e6e702c207.tar nixpkgs-e4fa8192da5269756ec225b99f9693e6e702c207.tar.gz nixpkgs-e4fa8192da5269756ec225b99f9693e6e702c207.tar.bz2 nixpkgs-e4fa8192da5269756ec225b99f9693e6e702c207.tar.lz nixpkgs-e4fa8192da5269756ec225b99f9693e6e702c207.tar.xz nixpkgs-e4fa8192da5269756ec225b99f9693e6e702c207.tar.zst nixpkgs-e4fa8192da5269756ec225b99f9693e6e702c207.zip |
nixos/tests/ec2: return to passing state
Updates required: - Use vpc image format (new default, supported by Amazon) - Pass full image filename to makeEc2Test - Increase memory allocation for nixos-rebuild - Set a networking.hostName for services.httpd - Add appropriate escaping in literal userdata While I'm here, try to make it fail fast.
Diffstat (limited to 'nixos/tests/ec2.nix')
-rw-r--r-- | nixos/tests/ec2.nix | 45 |
1 files changed, 32 insertions, 13 deletions
diff --git a/nixos/tests/ec2.nix b/nixos/tests/ec2.nix index c649ce852da..6aeeb17ba31 100644 --- a/nixos/tests/ec2.nix +++ b/nixos/tests/ec2.nix @@ -9,7 +9,7 @@ with pkgs.lib; with import common/ec2.nix { inherit makeTest pkgs; }; let - image = + imageCfg = (import ../lib/eval-config.nix { inherit system; modules = [ @@ -26,20 +26,32 @@ let ''; # Needed by nixos-rebuild due to the lack of network - # access. Mostly copied from - # modules/profiles/installation-device.nix. + # access. Determined by trial and error. system.extraDependencies = - with pkgs; [ - stdenv busybox perlPackages.ArchiveCpio unionfs-fuse mkinitcpio-nfs-utils - - # These are used in the configure-from-userdata tests for EC2. Httpd and valgrind are requested - # directly by the configuration we set, and libxslt.bin is used indirectly as a build dependency - # of the derivation for dbus configuration files. - apacheHttpd valgrind.doc libxslt.bin - ]; + with pkgs; ( + [ + # Needed for a nixos-rebuild. + busybox + stdenv + stdenvNoCC + mkinitcpio-nfs-utils + unionfs-fuse + cloud-utils + desktop-file-utils + texinfo + libxslt.bin + xorg.lndir + + # These are used in the configure-from-userdata tests + # for EC2. Httpd and valgrind are requested by the + # configuration. + apacheHttpd apacheHttpd.doc apacheHttpd.man valgrind.doc + ] + ); } ]; - }).config.system.build.amazonImage; + }).config; + image = "${imageCfg.system.build.amazonImage}/${imageCfg.amazonImage.name}.vhd"; sshKeys = import ./ssh-keys.nix pkgs; snakeOilPrivateKey = sshKeys.snakeOilPrivateKey.text; @@ -110,16 +122,23 @@ in { text = "whoa"; }; + networking.hostName = "ec2-test-vm"; # required by services.httpd + services.httpd = { enable = true; adminAddr = "test@example.org"; - virtualHosts.localhost.documentRoot = "${pkgs.valgrind.doc}/share/doc/valgrind/html"; + virtualHosts.localhost.documentRoot = "''${pkgs.valgrind.doc}/share/doc/valgrind/html"; }; networking.firewall.allowedTCPPorts = [ 80 ]; } ''; script = '' $machine->start; + + # amazon-init must succeed. if it fails, make the test fail + # immediately instead of timing out in waitForFile. + $machine->waitForUnit('amazon-init.service'); + $machine->waitForFile("/etc/testFile"); $machine->succeed("cat /etc/testFile | grep -q 'whoa'"); |