summary refs log tree commit diff
path: root/nixos/tests/ec2.nix
diff options
context:
space:
mode:
authorDan Peebles <pumpkin@me.com>2017-02-27 16:51:36 +0000
committerDan Peebles <pumpkin@me.com>2017-02-27 16:51:36 +0000
commit6018cf4a692b5e12e433cc332f8d8f79ccd57ba1 (patch)
tree36b165ad2e40712e7cb8711928998638251ad104 /nixos/tests/ec2.nix
parentbccac381b27592bdc22d151c744814716eb4f7ec (diff)
downloadnixpkgs-6018cf4a692b5e12e433cc332f8d8f79ccd57ba1.tar
nixpkgs-6018cf4a692b5e12e433cc332f8d8f79ccd57ba1.tar.gz
nixpkgs-6018cf4a692b5e12e433cc332f8d8f79ccd57ba1.tar.bz2
nixpkgs-6018cf4a692b5e12e433cc332f8d8f79ccd57ba1.tar.lz
nixpkgs-6018cf4a692b5e12e433cc332f8d8f79ccd57ba1.tar.xz
nixpkgs-6018cf4a692b5e12e433cc332f8d8f79ccd57ba1.tar.zst
nixpkgs-6018cf4a692b5e12e433cc332f8d8f79ccd57ba1.zip
amazon-init.service: fix starting services at startup
We now make it happen later in the boot process so that multi-user
has already activated, so as to not run afoul of the logic in
switch-to-configuration.pl. It's not my favorite solution, but at
least it works. Also added a check to the VM test to catch the failure
so we don't break in future.

Fixes #23121
Diffstat (limited to 'nixos/tests/ec2.nix')
-rw-r--r--nixos/tests/ec2.nix21
1 files changed, 19 insertions, 2 deletions
diff --git a/nixos/tests/ec2.nix b/nixos/tests/ec2.nix
index e1f7143e3a9..4ec7e56cc6c 100644
--- a/nixos/tests/ec2.nix
+++ b/nixos/tests/ec2.nix
@@ -25,8 +25,13 @@ let
           # access. Mostly copied from
           # modules/profiles/installation-device.nix.
           system.extraDependencies =
-            [ pkgs.stdenv pkgs.busybox pkgs.perlPackages.ArchiveCpio
-              pkgs.unionfs-fuse pkgs.mkinitcpio-nfs-utils
+            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
             ];
         }
       ];
@@ -137,6 +142,8 @@ in {
 
     # ### http://nixos.org/channels/nixos-unstable nixos
     userData = ''
+      { pkgs, ... }:
+
       {
         imports = [
           <nixpkgs/nixos/modules/virtualisation/amazon-image.nix>
@@ -146,12 +153,22 @@ in {
         environment.etc.testFile = {
           text = "whoa";
         };
+
+        services.httpd = {
+          enable = true;
+          adminAddr = "test@example.org";
+          documentRoot = "${pkgs.valgrind.doc}/share/doc/valgrind/html";
+        };
+        networking.firewall.allowedTCPPorts = [ 80 ];
       }
     '';
     script = ''
       $machine->start;
       $machine->waitForFile("/etc/testFile");
       $machine->succeed("cat /etc/testFile | grep -q 'whoa'");
+
+      $machine->waitForUnit("httpd.service");
+      $machine->succeed("curl http://localhost | grep Valgrind");
     '';
   };
 }