Add test with podman docker socket backend
This commit is contained in:
parent
e0e7531f7d
commit
286d56a83c
7 changed files with 55 additions and 20 deletions
|
@ -13,18 +13,23 @@ dimension "Nixpkgs version" {
|
|||
nixpkgsSource = "nixos-19.03";
|
||||
enableDoc = false;
|
||||
nixosTestIsPerl = true;
|
||||
dockerSupportsSystemd = true;
|
||||
nixosHasPodmanDockerSocket = false;
|
||||
};
|
||||
"nixos-20_09" = {
|
||||
nixpkgsSource = "nixos-20.09";
|
||||
isReferenceNixpkgs = true;
|
||||
enableDoc = true;
|
||||
dockerSupportsSystemd = true;
|
||||
nixosHasPodmanDockerSocket = false;
|
||||
};
|
||||
"nixos-unstable" = {
|
||||
nixpkgsSource = "nixos-unstable";
|
||||
enableDoc = true;
|
||||
};
|
||||
} (
|
||||
_name: { nixpkgsSource, isReferenceNixpkgs ? false, enableDoc ? true, nixosTestIsPerl ? false }:
|
||||
_name: { nixpkgsSource, isReferenceNixpkgs ? false, enableDoc ? true,
|
||||
nixosTestIsPerl ? false, dockerSupportsSystemd ? false, nixosHasPodmanDockerSocket ? true }:
|
||||
|
||||
|
||||
dimension "System" {
|
||||
|
@ -34,7 +39,7 @@ dimension "Nixpkgs version" {
|
|||
system: { isReferenceTarget ? false, enableNixOSTests ? true }:
|
||||
let
|
||||
pkgs = import ./. {
|
||||
inherit system nixosTestIsPerl;
|
||||
inherit system nixosTestIsPerl dockerSupportsSystemd nixosHasPodmanDockerSocket;
|
||||
nixpkgsSrc = sources.${nixpkgsSource};
|
||||
};
|
||||
in
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
, nixpkgsSrc ? sources.${nixpkgsName}
|
||||
, system ? builtins.currentSystem
|
||||
, nixosTestIsPerl ? false
|
||||
, dockerSupportsSystemd ? false
|
||||
, nixosHasPodmanDockerSocket ? true
|
||||
, ...
|
||||
}:
|
||||
|
||||
|
@ -11,8 +13,12 @@ import nixpkgsSrc ({
|
|||
config = {
|
||||
};
|
||||
overlays = [
|
||||
# all the packages are defined there:
|
||||
(_: _: { inherit nixosTestIsPerl; })
|
||||
(_: _: {
|
||||
inherit nixosTestIsPerl;
|
||||
arionTestingFlags = {
|
||||
inherit nixosTestIsPerl dockerSupportsSystemd nixosHasPodmanDockerSocket;
|
||||
};
|
||||
})
|
||||
(import ./overlay.nix)
|
||||
];
|
||||
inherit system;
|
||||
|
|
|
@ -36,15 +36,15 @@
|
|||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
||||
},
|
||||
"nixos-unstable": {
|
||||
"branch": "nixos-unstable",
|
||||
"branch": "wip-arion-prs",
|
||||
"description": "A read-only mirror of NixOS/nixpkgs tracking the released channels. Send issues and PRs to",
|
||||
"homepage": "https://github.com/NixOS/nixpkgs",
|
||||
"owner": "NixOS",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "296793637b22bdb4d23b479879eba0a71c132a66",
|
||||
"sha256": "0j09yih9693w5vjx64ikfxyja1ha7pisygrwrpg3wfz3sssglg69",
|
||||
"rev": "4f5e5257f4385bb178f2b14393c06bada5fdb65e",
|
||||
"sha256": "0m60fvajhx90hamn6arl3ifvbzfwrl2c80v5j44lwcl6n2bjgcmb",
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/NixOS/nixpkgs/archive/296793637b22bdb4d23b479879eba0a71c132a66.tar.gz",
|
||||
"url": "https://github.com/hercules-ci/nixpkgs/archive/4f5e5257f4385bb178f2b14393c06bada5fdb65e.tar.gz",
|
||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz",
|
||||
"version": ""
|
||||
},
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
"services": {
|
||||
"webserver": {
|
||||
"command": [
|
||||
"/nix/store/b9w61w4g8sqgrm3rid6ca22krslqghb3-nixos-system-unnamed-19.03.173100.e726e8291b2/init"
|
||||
"/usr/sbin/init"
|
||||
],
|
||||
"environment": {
|
||||
"NIX_REMOTE": "",
|
||||
"PATH": "/usr/bin:/run/current-system/sw/bin/",
|
||||
"container": "docker"
|
||||
},
|
||||
"image": "arion-base:<HASH>",
|
||||
"image": "webserver:<HASH>",
|
||||
"ports": [
|
||||
"8000:80"
|
||||
],
|
||||
|
@ -23,8 +23,7 @@
|
|||
"tty": true,
|
||||
"volumes": [
|
||||
"/sys/fs/cgroup:/sys/fs/cgroup:ro",
|
||||
"/nix/store:/nix/store:ro",
|
||||
"/nix/store/pssdmhzjnhflawv7rwk1yw39350iv40g-container-system-env:/run/system:ro"
|
||||
"/nix/store:/nix/store:ro"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
@ -32,8 +31,8 @@
|
|||
"x-arion": {
|
||||
"images": [
|
||||
{
|
||||
"image": "<STOREPATH>",
|
||||
"imageName": "arion-base",
|
||||
"imageExe": "<STOREPATH>",
|
||||
"imageName": "webserver",
|
||||
"imageTag": "<HASH>"
|
||||
}
|
||||
],
|
||||
|
|
|
@ -24,7 +24,13 @@ in
|
|||
../nixos/default-shell.nix
|
||||
(pkgs.path + "/nixos/modules/profiles/minimal.nix")
|
||||
];
|
||||
image.command = [ "${config.nixos.build.toplevel}/init" ];
|
||||
image.command = [ "/usr/sbin/init" ];
|
||||
image.contents = [
|
||||
(pkgs.runCommand "root-init" {} ''
|
||||
mkdir -p $out/usr/sbin
|
||||
ln -s ${config.nixos.build.toplevel}/init $out/usr/sbin/init
|
||||
'')
|
||||
];
|
||||
service.environment.container = "docker";
|
||||
service.environment.PATH = "/usr/bin:/run/current-system/sw/bin/";
|
||||
service.volumes = [
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ pkgs, ... }:
|
||||
{ usePodman ? false, pkgs, lib, ... }:
|
||||
|
||||
let
|
||||
# To make some prebuilt derivations available in the vm
|
||||
|
@ -6,14 +6,26 @@ let
|
|||
inherit modules;
|
||||
inherit pkgs;
|
||||
};
|
||||
|
||||
inherit (lib)
|
||||
optionalAttrs
|
||||
optionalString
|
||||
;
|
||||
|
||||
haveSystemd = usePodman || pkgs.arionTestingFlags.dockerSupportsSystemd;
|
||||
|
||||
in
|
||||
{
|
||||
name = "arion-test";
|
||||
machine = { pkgs, lib, ... }: {
|
||||
environment.systemPackages = [
|
||||
pkgs.arion
|
||||
];
|
||||
virtualisation.docker.enable = true;
|
||||
] ++ lib.optional usePodman pkgs.docker;
|
||||
virtualisation.docker.enable = !usePodman;
|
||||
virtualisation.podman = optionalAttrs usePodman {
|
||||
enable = true;
|
||||
dockerSocket.enable = true;
|
||||
};
|
||||
|
||||
# no caches, because no internet
|
||||
nix.binaryCaches = lib.mkForce [];
|
||||
|
@ -38,6 +50,7 @@ in
|
|||
];
|
||||
|
||||
virtualisation.memorySize = 1024;
|
||||
virtualisation.diskSize = 8000;
|
||||
};
|
||||
testScript = ''
|
||||
machine.fail("curl --fail localhost:8000")
|
||||
|
@ -71,6 +84,7 @@ in
|
|||
# machine.succeed("cd work && NIX_PATH= arion down")
|
||||
# machine.wait_until_fails("curl --fail localhost:8000")
|
||||
|
||||
${optionalString haveSystemd ''
|
||||
# Tests
|
||||
# - arion exec
|
||||
# - examples/full-nixos
|
||||
|
@ -95,6 +109,7 @@ in
|
|||
"cd work && NIX_PATH=nixpkgs='${pkgs.path}' arion down"
|
||||
)
|
||||
machine.wait_until_fails("curl --fail localhost:8000")
|
||||
''}
|
||||
|
||||
# Tests
|
||||
# - examples/nixos-unit
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ pkgs ? import ../pkgs.nix, nixosTestIsPerl ? false }:
|
||||
{ pkgs ? import ../pkgs.nix, nixosTestIsPerl ? false, arionTestingFlags ? {} }:
|
||||
let
|
||||
inherit (pkgs) nixosTest recurseIntoAttrs arion;
|
||||
in
|
||||
|
@ -6,6 +6,10 @@ in
|
|||
recurseIntoAttrs {
|
||||
|
||||
test = if nixosTestIsPerl then nixosTest ./arion-test-perl else nixosTest ./arion-test;
|
||||
testWithPodman =
|
||||
if arionTestingFlags.nixosHasPodmanDockerSocket
|
||||
then nixosTest (pkgs.callPackage ./arion-test { usePodman = true; })
|
||||
else {};
|
||||
|
||||
testBuild = arion.build {
|
||||
|
||||
|
|
Loading…
Reference in a new issue