mirror of
https://github.com/NixOS/nix
synced 2025-07-07 06:01:48 +02:00
Merge pull request #7648 from hercules-ci/move-nixos-tests
Move nixos tests
This commit is contained in:
commit
ccaadc9575
11 changed files with 57 additions and 98 deletions
|
@ -1,12 +1,7 @@
|
|||
# Test whether we can run a NixOS container inside a Nix build using systemd-nspawn.
|
||||
{ nixpkgs, system, overlay }:
|
||||
{ lib, nixpkgs, ... }:
|
||||
|
||||
with import (nixpkgs + "/nixos/lib/testing-python.nix") {
|
||||
inherit system;
|
||||
extraConfigurations = [ { nixpkgs.overlays = [ overlay ]; } ];
|
||||
};
|
||||
|
||||
makeTest ({
|
||||
{
|
||||
name = "containers";
|
||||
|
||||
nodes =
|
||||
|
@ -65,4 +60,4 @@ makeTest ({
|
|||
host.succeed("[[ $(cat ./result/msg) = 'Hello World' ]]")
|
||||
'';
|
||||
|
||||
})
|
||||
}
|
|
@ -1,14 +1,9 @@
|
|||
{ nixpkgs, system, overlay }:
|
||||
|
||||
with import (nixpkgs + "/nixos/lib/testing-python.nix") {
|
||||
inherit system;
|
||||
extraConfigurations = [ { nixpkgs.overlays = [ overlay ]; } ];
|
||||
};
|
||||
|
||||
{ lib, config, nixpkgs, ... }:
|
||||
let
|
||||
pkgs = config.nodes.client.nixpkgs.pkgs;
|
||||
|
||||
# Generate a fake root CA and a fake api.github.com / github.com / channels.nixos.org certificate.
|
||||
cert = pkgs.runCommand "cert" { buildInputs = [ pkgs.openssl ]; }
|
||||
cert = pkgs.runCommand "cert" { nativeBuildInputs = [ pkgs.openssl ]; }
|
||||
''
|
||||
mkdir -p $out
|
||||
|
||||
|
@ -92,8 +87,6 @@ let
|
|||
'';
|
||||
in
|
||||
|
||||
makeTest (
|
||||
|
||||
{
|
||||
name = "github-flakes";
|
||||
|
||||
|
@ -207,4 +200,4 @@ makeTest (
|
|||
client.succeed("nix build nixpkgs#fuse --tarball-ttl 0")
|
||||
'';
|
||||
|
||||
})
|
||||
}
|
|
@ -1,13 +1,16 @@
|
|||
# Test ‘nix-copy-closure’.
|
||||
|
||||
{ nixpkgs, system, overlay }:
|
||||
{ lib, config, nixpkgs, hostPkgs, ... }:
|
||||
|
||||
with import (nixpkgs + "/nixos/lib/testing-python.nix") {
|
||||
inherit system;
|
||||
extraConfigurations = [ { nixpkgs.overlays = [ overlay ]; } ];
|
||||
};
|
||||
let
|
||||
pkgs = config.nodes.client.nixpkgs.pkgs;
|
||||
|
||||
makeTest (let pkgA = pkgs.cowsay; pkgB = pkgs.wget; pkgC = pkgs.hello; pkgD = pkgs.tmux; in {
|
||||
pkgA = pkgs.cowsay;
|
||||
pkgB = pkgs.wget;
|
||||
pkgC = pkgs.hello;
|
||||
pkgD = pkgs.tmux;
|
||||
|
||||
in {
|
||||
name = "nix-copy-closure";
|
||||
|
||||
nodes =
|
||||
|
@ -74,4 +77,4 @@ makeTest (let pkgA = pkgs.cowsay; pkgB = pkgs.wget; pkgC = pkgs.hello; pkgD = pk
|
|||
# )
|
||||
# client.succeed("nix-store --check-validity ${pkgC}")
|
||||
'';
|
||||
})
|
||||
}
|
|
@ -1,11 +1,9 @@
|
|||
{ nixpkgs, system, overlay }:
|
||||
|
||||
with import (nixpkgs + "/nixos/lib/testing-python.nix") {
|
||||
inherit system;
|
||||
extraConfigurations = [ { nixpkgs.overlays = [ overlay ]; } ];
|
||||
};
|
||||
{ lib, config, nixpkgs, ... }:
|
||||
|
||||
let
|
||||
|
||||
pkgs = config.nodes.client.nixpkgs.pkgs;
|
||||
|
||||
nix-fetch = pkgs.writeText "fetch.nix" ''
|
||||
derivation {
|
||||
# This derivation is an copy from what is available over at
|
||||
|
@ -41,9 +39,7 @@ let
|
|||
'';
|
||||
in
|
||||
|
||||
makeTest (
|
||||
|
||||
rec {
|
||||
{
|
||||
name = "nss-preload";
|
||||
|
||||
nodes = {
|
||||
|
@ -122,4 +118,4 @@ rec {
|
|||
nix-build ${nix-fetch} >&2
|
||||
""")
|
||||
'';
|
||||
})
|
||||
}
|
|
@ -1,15 +1,9 @@
|
|||
# Test Nix's remote build feature.
|
||||
|
||||
{ nixpkgs, system, overlay }:
|
||||
|
||||
with import (nixpkgs + "/nixos/lib/testing-python.nix") {
|
||||
inherit system;
|
||||
extraConfigurations = [ { nixpkgs.overlays = [ overlay ]; } ];
|
||||
};
|
||||
|
||||
makeTest (
|
||||
{ config, lib, hostPkgs, ... }:
|
||||
|
||||
let
|
||||
pkgs = config.nodes.client.nixpkgs.pkgs;
|
||||
|
||||
# The configuration of the remote builders.
|
||||
builder =
|
||||
|
@ -75,7 +69,7 @@ in
|
|||
|
||||
# Create an SSH key on the client.
|
||||
subprocess.run([
|
||||
"${pkgs.openssh}/bin/ssh-keygen", "-t", "ed25519", "-f", "key", "-N", ""
|
||||
"${hostPkgs.openssh}/bin/ssh-keygen", "-t", "ed25519", "-f", "key", "-N", ""
|
||||
], capture_output=True, check=True)
|
||||
client.succeed("mkdir -p -m 700 /root/.ssh")
|
||||
client.copy_from_host("key", "/root/.ssh/id_ed25519")
|
||||
|
@ -109,4 +103,4 @@ in
|
|||
builder1.block()
|
||||
client.succeed("nix-build ${expr nodes.client.config 4}")
|
||||
'';
|
||||
})
|
||||
}
|
|
@ -1,13 +1,12 @@
|
|||
# Verify that Linux builds cannot create setuid or setgid binaries.
|
||||
|
||||
{ nixpkgs, system, overlay }:
|
||||
{ lib, config, nixpkgs, ... }:
|
||||
|
||||
with import (nixpkgs + "/nixos/lib/testing-python.nix") {
|
||||
inherit system;
|
||||
extraConfigurations = [ { nixpkgs.overlays = [ overlay ]; } ];
|
||||
};
|
||||
let
|
||||
pkgs = config.nodes.machine.nixpkgs.pkgs;
|
||||
|
||||
makeTest {
|
||||
in
|
||||
{
|
||||
name = "setuid";
|
||||
|
||||
nodes.machine =
|
|
@ -1,12 +1,8 @@
|
|||
{ nixpkgs, system, overlay }:
|
||||
|
||||
with import (nixpkgs + "/nixos/lib/testing-python.nix")
|
||||
{
|
||||
inherit system;
|
||||
extraConfigurations = [{ nixpkgs.overlays = [ overlay ]; }];
|
||||
};
|
||||
{ lib, config, hostPkgs, nixpkgs, ... }:
|
||||
|
||||
let
|
||||
pkgs = config.nodes.sourcehut.nixpkgs.pkgs;
|
||||
|
||||
# Generate a fake root CA and a fake git.sr.ht certificate.
|
||||
cert = pkgs.runCommand "cert" { buildInputs = [ pkgs.openssl ]; }
|
||||
''
|
||||
|
@ -64,8 +60,6 @@ let
|
|||
|
||||
in
|
||||
|
||||
makeTest (
|
||||
|
||||
{
|
||||
name = "sourcehut-flakes";
|
||||
|
||||
|
@ -164,4 +158,4 @@ makeTest (
|
|||
client.succeed("nix build nixpkgs#fuse --tarball-ttl 0")
|
||||
'';
|
||||
|
||||
})
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue