Revert "Make ec2 tests a channel blocker" (#506533)

This commit is contained in:
Vladimír Čunát
2026-04-04 10:16:00 +02:00
committed by GitHub
3 changed files with 79 additions and 4 deletions
-1
View File
@@ -87,7 +87,6 @@ rec {
(onFullSupported "nixos.tests.containers-ip")
(onSystems [ "x86_64-linux" ] "nixos.tests.docker")
(onFullSupported "nixos.tests.env")
(onSystems [ "x86_64-linux" "aarch64-linux" ] "nixos.tests.ec2-userdata")
# Way too many manual retries required on Hydra.
# Apparently it's hard to track down the cause.
+2 -1
View File
@@ -489,8 +489,9 @@ in
early-mount-options = runTest ./early-mount-options.nix;
earlyoom = runTestOn [ "x86_64-linux" ] ./earlyoom.nix;
easytier = runTest ./easytier.nix;
ec2-config = (handleTestOn [ "x86_64-linux" ] ./ec2.nix { }).boot-ec2-config or { };
ec2-image = runTest ./ec2-image.nix;
ec2-userdata = (handleTestOn [ "x86_64-linux" ] ./ec2.nix { }).ec2-userdata or { };
ec2-nixops = (handleTestOn [ "x86_64-linux" ] ./ec2.nix { }).boot-ec2-nixops or { };
echoip = runTest ./echoip.nix;
ejabberd = runTest ./xmpp/ejabberd.nix;
elk = handleTestOn [ "x86_64-linux" ] ./elk.nix { };
+77 -2
View File
@@ -18,6 +18,12 @@ let
../modules/testing/test-instrumentation.nix
../modules/profiles/qemu-guest.nix
{
# Hack to make the partition resizing work in QEMU.
boot.initrd.postDeviceCommands = mkBefore ''
ln -s vda /dev/xvda
ln -s vda1 /dev/xvda1
'';
amazonImage.format = "qcow2";
# In a NixOS test the serial console is occupied by the "backdoor"
@@ -25,6 +31,30 @@ let
# the configuration in virtualisation/amazon-image.nix.
systemd.services."serial-getty@ttyS0".enable = mkForce false;
# Needed by nixos-rebuild due to the lack of network
# access. Determined by trial and error.
system.extraDependencies = with pkgs; [
# Needed for a nixos-rebuild.
busybox
cloud-utils
desktop-file-utils
libxslt.bin
mkinitcpio-nfs-utils
stdenv
stdenvNoCC
texinfo
unionfs-fuse
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
];
nixpkgs.pkgs = pkgs;
}
];
@@ -38,8 +68,8 @@ let
in
{
ec2-userdata = makeEc2Test {
name = "ec2-userdata";
boot-ec2-nixops = makeEc2Test {
name = "nixops-userdata";
meta.timeout = 600;
inherit image;
sshPublicKey = snakeOilPublicKey; # That's right folks! My user's key is also the host key!
@@ -86,4 +116,49 @@ in
machine.wait_for_file("/etc/ec2-metadata/user-data")
'';
};
boot-ec2-config = makeEc2Test {
name = "config-userdata";
meta.broken = true; # amazon-init wants to download from the internet while building the system
inherit image;
sshPublicKey = snakeOilPublicKey;
# ### https://channels.nixos.org/nixos-unstable nixos
userData = ''
{ pkgs, ... }:
{
imports = [
<nixpkgs/nixos/modules/virtualisation/amazon-image.nix>
<nixpkgs/nixos/modules/testing/test-instrumentation.nix>
<nixpkgs/nixos/modules/profiles/qemu-guest.nix>
];
environment.etc.testFile = {
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";
};
networking.firewall.allowedTCPPorts = [ 80 ];
}
'';
script = ''
machine.start()
# amazon-init must succeed. if it fails, make the test fail
# immediately instead of timing out in wait_for_file.
machine.wait_for_unit("amazon-init.service")
machine.wait_for_file("/etc/testFile")
assert "whoa" in machine.succeed("cat /etc/testFile")
machine.wait_for_unit("httpd.service")
assert "Valgrind" in machine.succeed("curl http://localhost")
'';
};
}