Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

podman packages: add passthru tests #88106

Merged
merged 7 commits into from May 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 26 additions & 4 deletions nixos/tests/podman.nix
Expand Up @@ -38,23 +38,45 @@ import ./make-test-python.nix (
start_all()


with subtest("Run container as root"):
with subtest("Run container as root with runc"):
podman.succeed("tar cv --files-from /dev/null | podman import - scratchimg")
podman.succeed(
"podman run -d --name=sleeping -v /nix/store:/nix/store -v /run/current-system/sw/bin:/bin scratchimg /bin/sleep 10"
"podman run --runtime=runc -d --name=sleeping -v /nix/store:/nix/store -v /run/current-system/sw/bin:/bin scratchimg /bin/sleep 10"
)
podman.succeed("podman ps | grep sleeping")
podman.succeed("podman stop sleeping")
podman.succeed("podman rm sleeping")

with subtest("Run container rootless"):
with subtest("Run container as root with crun"):
podman.succeed("tar cv --files-from /dev/null | podman import - scratchimg")
podman.succeed(
"podman run --runtime=crun -d --name=sleeping -v /nix/store:/nix/store -v /run/current-system/sw/bin:/bin scratchimg /bin/sleep 10"
)
podman.succeed("podman ps | grep sleeping")
podman.succeed("podman stop sleeping")
podman.succeed("podman rm sleeping")

with subtest("Run container rootless with runc"):
podman.succeed(su_cmd("tar cv --files-from /dev/null | podman import - scratchimg"))
podman.succeed(
su_cmd(
"podman run --runtime=runc -d --name=sleeping -v /nix/store:/nix/store -v /run/current-system/sw/bin:/bin scratchimg /bin/sleep 10"
)
)
podman.succeed(su_cmd("podman ps | grep sleeping"))
podman.succeed(su_cmd("podman stop sleeping"))
podman.succeed(su_cmd("podman rm sleeping"))

with subtest("Run container rootless with crun"):
podman.succeed(su_cmd("tar cv --files-from /dev/null | podman import - scratchimg"))
podman.succeed(
su_cmd(
"podman run -d --name=sleeping -v /nix/store:/nix/store -v /run/current-system/sw/bin:/bin scratchimg /bin/sleep 10"
"podman run --runtime=crun -d --name=sleeping -v /nix/store:/nix/store -v /run/current-system/sw/bin:/bin scratchimg /bin/sleep 10"
)
)
podman.succeed(su_cmd("podman ps | grep sleeping"))
podman.succeed(su_cmd("podman stop sleeping"))
podman.succeed(su_cmd("podman rm sleeping"))
'';
}
)
4 changes: 3 additions & 1 deletion pkgs/applications/networking/cluster/cni/plugins.nix
@@ -1,4 +1,4 @@
{ lib, fetchFromGitHub, buildGoModule }:
{ lib, fetchFromGitHub, buildGoModule, nixosTests }:

buildGoModule rec {
pname = "cni-plugins";
Expand Down Expand Up @@ -36,6 +36,8 @@ buildGoModule rec {
"plugins/meta/tuning"
];

passthru.tests.podman = nixosTests.podman;

meta = with lib; {
description = "Some standard networking plugins, maintained by the CNI team";
homepage = "https://github.com/containernetworking/plugins";
Expand Down
3 changes: 3 additions & 0 deletions pkgs/applications/virtualization/conmon/default.nix
Expand Up @@ -4,6 +4,7 @@
, glib
, glibc
, systemd
, nixosTests
}:

stdenv.mkDerivation rec {
Expand All @@ -23,6 +24,8 @@ stdenv.mkDerivation rec {

installFlags = [ "PREFIX=$(out)" ];

passthru.tests.podman = nixosTests.podman;

meta = with stdenv.lib; {
homepage = "https://github.com/containers/conmon";
description = "An OCI container runtime monitor";
Expand Down
3 changes: 3 additions & 0 deletions pkgs/applications/virtualization/crun/default.nix
Expand Up @@ -9,6 +9,7 @@
, python3
, systemd
, yajl
, nixosTests
}:

let
Expand Down Expand Up @@ -62,6 +63,8 @@ stdenv.mkDerivation rec {

doCheck = true;

passthru.tests.podman = nixosTests.podman;

meta = with lib; {
description = "A fast and lightweight fully featured OCI runtime and C library for running containers";
license = licenses.gpl2Plus;
Expand Down
3 changes: 3 additions & 0 deletions pkgs/applications/virtualization/runc/default.nix
Expand Up @@ -9,6 +9,7 @@
, apparmor-parser
, libseccomp
, libselinux
, nixosTests
}:

buildGoPackage rec {
Expand Down Expand Up @@ -45,6 +46,8 @@ buildGoPackage rec {
installManPage man/*/*.[1-9]
'';

passthru.tests.podman = nixosTests.podman;

meta = with lib; {
homepage = "https://github.com/opencontainers/runc";
description = "A CLI tool for spawning and running containers according to the OCI specification";
Expand Down
4 changes: 3 additions & 1 deletion pkgs/tools/filesystems/fuse-overlayfs/default.nix
@@ -1,4 +1,4 @@
{ stdenv, fetchFromGitHub, autoreconfHook, pkg-config, fuse3 }:
{ stdenv, fetchFromGitHub, autoreconfHook, pkg-config, fuse3, nixosTests }:

stdenv.mkDerivation rec {
pname = "fuse-overlayfs";
Expand All @@ -15,6 +15,8 @@ stdenv.mkDerivation rec {

buildInputs = [ fuse3 ];

passthru.tests.podman = nixosTests.podman;

meta = with stdenv.lib; {
description = "FUSE implementation for overlayfs";
longDescription = "An implementation of overlay+shiftfs in FUSE for rootless containers.";
Expand Down
3 changes: 3 additions & 0 deletions pkgs/tools/networking/slirp4netns/default.nix
Expand Up @@ -6,6 +6,7 @@
, libcap
, libseccomp
, libslirp
, nixosTests
}:

stdenv.mkDerivation rec {
Expand All @@ -25,6 +26,8 @@ stdenv.mkDerivation rec {

enableParallelBuilding = true;

passthru.tests.podman = nixosTests.podman;

meta = with stdenv.lib; {
homepage = "https://github.com/rootless-containers/slirp4netns";
description = "User-mode networking for unprivileged network namespaces";
Expand Down