Merge pull request #88106 from zowoq/tests

podman packages: add passthru tests
This commit is contained in:
adisbladis 2020-05-19 03:14:43 +02:00 committed by GitHub
commit 9aebaa1704
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 44 additions and 6 deletions

View File

@ -38,23 +38,45 @@ import ./make-test-python.nix (
start_all() 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("tar cv --files-from /dev/null | podman import - scratchimg")
podman.succeed( 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 ps | grep sleeping")
podman.succeed("podman stop 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("tar cv --files-from /dev/null | podman import - scratchimg"))
podman.succeed( podman.succeed(
su_cmd( 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=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 ps | grep sleeping"))
podman.succeed(su_cmd("podman stop 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 --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"))
''; '';
} }
) )

View File

@ -1,4 +1,4 @@
{ lib, fetchFromGitHub, buildGoModule }: { lib, fetchFromGitHub, buildGoModule, nixosTests }:
buildGoModule rec { buildGoModule rec {
pname = "cni-plugins"; pname = "cni-plugins";
@ -36,6 +36,8 @@ buildGoModule rec {
"plugins/meta/tuning" "plugins/meta/tuning"
]; ];
passthru.tests.podman = nixosTests.podman;
meta = with lib; { meta = with lib; {
description = "Some standard networking plugins, maintained by the CNI team"; description = "Some standard networking plugins, maintained by the CNI team";
homepage = "https://github.com/containernetworking/plugins"; homepage = "https://github.com/containernetworking/plugins";

View File

@ -4,6 +4,7 @@
, glib , glib
, glibc , glibc
, systemd , systemd
, nixosTests
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
@ -23,6 +24,8 @@ stdenv.mkDerivation rec {
installFlags = [ "PREFIX=$(out)" ]; installFlags = [ "PREFIX=$(out)" ];
passthru.tests.podman = nixosTests.podman;
meta = with stdenv.lib; { meta = with stdenv.lib; {
homepage = "https://github.com/containers/conmon"; homepage = "https://github.com/containers/conmon";
description = "An OCI container runtime monitor"; description = "An OCI container runtime monitor";

View File

@ -9,6 +9,7 @@
, python3 , python3
, systemd , systemd
, yajl , yajl
, nixosTests
}: }:
let let
@ -62,6 +63,8 @@ stdenv.mkDerivation rec {
doCheck = true; doCheck = true;
passthru.tests.podman = nixosTests.podman;
meta = with lib; { meta = with lib; {
description = "A fast and lightweight fully featured OCI runtime and C library for running containers"; description = "A fast and lightweight fully featured OCI runtime and C library for running containers";
license = licenses.gpl2Plus; license = licenses.gpl2Plus;

View File

@ -9,6 +9,7 @@
, apparmor-parser , apparmor-parser
, libseccomp , libseccomp
, libselinux , libselinux
, nixosTests
}: }:
buildGoPackage rec { buildGoPackage rec {
@ -45,6 +46,8 @@ buildGoPackage rec {
installManPage man/*/*.[1-9] installManPage man/*/*.[1-9]
''; '';
passthru.tests.podman = nixosTests.podman;
meta = with lib; { meta = with lib; {
homepage = "https://github.com/opencontainers/runc"; homepage = "https://github.com/opencontainers/runc";
description = "A CLI tool for spawning and running containers according to the OCI specification"; description = "A CLI tool for spawning and running containers according to the OCI specification";

View File

@ -1,4 +1,4 @@
{ stdenv, fetchFromGitHub, autoreconfHook, pkg-config, fuse3 }: { stdenv, fetchFromGitHub, autoreconfHook, pkg-config, fuse3, nixosTests }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "fuse-overlayfs"; pname = "fuse-overlayfs";
@ -15,6 +15,8 @@ stdenv.mkDerivation rec {
buildInputs = [ fuse3 ]; buildInputs = [ fuse3 ];
passthru.tests.podman = nixosTests.podman;
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "FUSE implementation for overlayfs"; description = "FUSE implementation for overlayfs";
longDescription = "An implementation of overlay+shiftfs in FUSE for rootless containers."; longDescription = "An implementation of overlay+shiftfs in FUSE for rootless containers.";

View File

@ -6,6 +6,7 @@
, libcap , libcap
, libseccomp , libseccomp
, libslirp , libslirp
, nixosTests
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
@ -25,6 +26,8 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true; enableParallelBuilding = true;
passthru.tests.podman = nixosTests.podman;
meta = with stdenv.lib; { meta = with stdenv.lib; {
homepage = "https://github.com/rootless-containers/slirp4netns"; homepage = "https://github.com/rootless-containers/slirp4netns";
description = "User-mode networking for unprivileged network namespaces"; description = "User-mode networking for unprivileged network namespaces";