Commit Graph

72 Commits

Author SHA1 Message Date
Kir Kolyshkin bdad2859f7 Dockerfile, Vagrantfile.centos7: use go 1.16
Dockerfile: switch from go 1.15 to go 1.16.x.

Vagrantfile.centos7: switch from go 1.15 to go 1.16.4.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-05-12 11:33:58 -07:00
Kir Kolyshkin 5ab0588432 ci: untangle getting test images
This simplifies and optimizes getting container images used for tests.

Currently, we have three different ways of getting images:

1. (for hello-world) the image is in this repo under tests/integration/testdata.

2. (for busybox) download it from github (the repo that is used for
   preparing official Docker image) using curl.

3. (for debian) download from Docker hub, using skopeo and umoci.

To further complicate things, we have to do this downloading in multiple
scenarios (at least 4): locally, in github CI, from Dockefile, inside a
Vagrant VM. For each scenario, we have to install skopeo and umoci, and
those two are not yet universally available for all the distros that we
use.

Yet another complication is those images are used for tests/integration
(bats-driven tests) as well as for libcontainer/integration (go tests).
The tests in libcontainer/integration rely on busybox being available
from /busybox, and the bats tests just download the images to a
temporary location during every run.

It is also hard to support CI for other architectures, because all
the machinery for preparing images is so complicated.

This commit is an attempt to simplify and optimize getting images,
mostly by getting rid of skopeo and umoci dependencies, but also
by moving the download logic into one small shell script, which
is used from all the places.

Benefits:

 - images (if not present) are only downloaded once;
 - same images are used for both kind of tests (go and bats);
 - same images are used for local and inside-docker tests
   (because source directory is mounted into container);
 - the download logic is located within 1 simple shell script.

[v2: fix eval; more doc to get-images; print URL if curl failed]
[v3: use "slim" debian, twice as small]
[v4: fix not using $image in setup_bundle]
[v5: don't remove TESTDATA from helpers.bash]
[v6: add i386 support]

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-02-02 16:03:29 -08:00
Aleksa Sarai 8bd19cd5f8 tests: add seccomp -ENOSYS integration test
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2021-01-28 23:11:25 +11:00
Kir Kolyshkin 7ecba232e9 ci: move cross compile check from travis to gha
In here we have to use Docker, as Ubuntu does not support
all the architectures we're compile-testing here.

Since this is the only step that is using Docker,
there is no sense to separate `make runcimage` from
the rest of it. In case we'll have to use Docker image
more, it will make sense to do so.

While at it, ditch script/tmpmount (added by commit 1735ad788f),
because
 - it required root (because mount);
 - it is probably no longer needed.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-01-05 20:45:28 -08:00
Kir Kolyshkin be56333fff bats: update to 1.2.1
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-12-02 19:28:40 -08:00
Kir Kolyshkin f15c4cca2c Update umoci to 0.4.6
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-12-02 19:28:34 -08:00
Kir Kolyshkin 4344bd8f14 Dockerfile: use binary criu release
This "reverts" commit 9ff7b82f9. We use the repo provided and maintained
by the CRIU team instead of compiling it from source.

While at it,

1. Don't install packages that were solely needed to compile CRIU.

2. Combine all apt-related stuff into a single step, so we don't
   download and then remove apt metadata 3 times.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-12-02 19:27:42 -08:00
Kir Kolyshkin 7856c34018 Dockerfile: bump criu to 3.15
Changes: see https://criu.org/Download/criu/3.15

Note in Vagrant.centos7 we use Adrian's repo [1] which already have criu
3.15, and in Vagrant.fedora33 we use stock fedora which also already has
criu 3.15.

[1] https://copr.fedorainfracloud.org/coprs/adrian/criu-el7/packages/

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-11-20 10:35:32 -08:00
Kir Kolyshkin f0d5e83966 Dockefile: fix path to skopeo repo
The current URL now gives 404. I looked in there and found that
apparently Debian_Unstable becomes Debian_10. Fix the URLs accordingly.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-11-19 18:19:01 -08:00
Akihiro Suda 4c71a68c6e upgrade Go to 1.15
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2020-08-12 15:37:25 +09:00
Xiaodong Liu a4cb88f307 redundant souce code copy
There is a docker -v flag for test in Makefile

Signed-off-by: Xiaodong Liu <liuxiaodong@loongson.cn>
2020-07-06 19:03:26 +08:00
Renaud Gaubert 861afa7509 Add integration tests for the new runc hooks
This patch adds a test based on real world usage of runc hooks
(libnvidia-container). We verify that mounting a library inside
a container and running ldconfig succeeds.

Signed-off-by: Renaud Gaubert <rgaubert@nvidia.com>
2020-06-19 02:39:20 +00:00
Kir Kolyshkin 236ec04599 Dockerfile: speed up criu build
... in case we have more than one CPU, that is.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-05-19 17:19:14 -07:00
Kir Kolyshkin 17aee8c432 Dockerfile: bump bats to 1.2.0
Release notes: https://github.com/bats-core/bats-core/releases/tag/v1.2.0

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-05-12 11:54:17 -07:00
Kir Kolyshkin 9634a80ce8 Dockerfile: bump criu to version π (3.14)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-05-02 14:14:34 -07:00
Kir Kolyshkin d4bc7c10ec Dockerfile: use bats-core
The bats testing framework we use for integration test is not maintained
since 2015 and was superceded by bats-core [1]. More to say, we were
using an unreleased version and relying on some features of it
(unfortunately I don't remember now what are those features exactly).

As Debian still packages very old version of bats from the old repo,
so let's Use recent bats-core from the new, supposedly better maintained,
github repo.

[1] https://github.com/sstephenson/bats/pull/269

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-04-22 15:34:44 -07:00
Adrian Reber 3e99aa3628 Fix checkpoint/restore tests on Fedora 31
The Travis tests running on Fedora 31 with cgroup2 on Vagrant had the
CRIU parts disabled because of a couple of problems.

One problem was a bug in runc and CRIU handling that Andrei fixed.

In addition four patches from the upcoming  CRIU 3.14 are needed for
minimal cgroup2 support (freezer and mounting of cgroup2). With Andrei's
fix and the CRIU cgroup2 support and the runc CRIU cgroup2 integration
it is now possible the checkpoint integration tests again on the Fedora
Vagrant cgroup2 based integration test.

To run CRIU based tests the modules of Fedora 31 (the test host system)
are mounted inside of the container used to test runc in the buster
based container with -v /lib/modules:/lib/modules.

Signed-off-by: Adrian Reber <areber@redhat.com>
2020-03-31 16:36:36 +02:00
Sebastiaan van Stijn dca34a0417 Dockerfile: switch to "buster" variant (current stable)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-03-30 21:59:28 +02:00
Sebastiaan van Stijn 48bf88c40e Dockerfile: prevent busting build-cache for busybox rootfs
Move adding the source code to the end, so that the busybox rootfs
doesn't have to be fetched again on each code change.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-03-30 21:59:26 +02:00
Sebastiaan van Stijn a596387689 Dockerfile: sort dependencies, and cleanup apt cache
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-03-30 21:59:24 +02:00
Sebastiaan van Stijn c4821c2bd8 Dockerfile: set DEBIAN_FRONTEND=noninteractive
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-03-30 21:59:21 +02:00
Sebastiaan van Stijn 201152a976 Dockerfile: use build-args to allow overriding versions
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-03-30 21:59:17 +02:00
Mrunal Patel 53ad1d5100 Merge pull request #2256 from kolyshkin/mountinfo-alt
Use faster mountinfo parser (part 1)
2020-03-27 11:36:51 -07:00
Kir Kolyshkin 3147c3200e Switch to golang 1.13, drop unsupported versions
Run CI with go 1.13 and 1.14 (aka "stable").

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-03-21 10:33:23 -07:00
Kir Kolyshkin 88a0244783 Dockerfile: add -f to curl
When github is giving HTTP 404 (or other error), it still sends some
document (to be viewed in a browser), but we have tar on the other end
of the pipe, so the end result is like this:

> Step 13/13 : RUN . tests/integration/multi-arch.bash     && curl -o- -sSL `get_busybox` | tar xfJC - ${ROOTFS}
> 4872 ---> Running in ad84646a69f3
> 4873xz: (stdin): File format not recognized
> 4874tar: Child returned status 1
> 4875tar: Error is not recoverable: exiting now
> 4876The command '/bin/sh -c . tests/integration/multi-arch.bash     && curl -o- -sSL `get_busybox` | tar xfJC - ${ROOTFS}' returned a non-zero code: 2

Add -f switch to curl, so it will display an HTTP error and exit:

> curl: (22) The requested URL returned error: 404 Not Found
> xz: (stdin): File format not recognized
> tar: Child returned status 1
> tar: Error is not recoverable: exiting now

While at it, also
 * remove -v from criu untar (too much output)
 * remove -o - from curl (it does the same by default)

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-03-20 17:26:15 -07:00
Mrunal Patel 0fd4342a92 Merge pull request #2028 from thaJeztah/bump_golang_versions
Update to Go 1.12 and drop obsolete versions
2019-09-05 16:30:01 -07:00
Akihiro Suda 7e67862542 Bump CRIU to 3.12
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2019-07-08 17:22:57 +09:00
Sebastiaan van Stijn e7831f2abb Update to Go 1.12 and drop obsolete versions
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-04-12 16:27:40 +02:00
Adrian Reber 403986c5dd Add CRIU patch to fix checkpoint test
For the newly integrated feature to use CRIU configuration files the
test is broken without an additional CRIU patch.

The test changes CRIU's log file. Changing the log file is unfortunately
the only thing which is in broken in CRIU 3.11. But it is the easiest
option for testing. With CRIU 3.12 this will be fixed. All other CRIU
options can be changed with a CRIU configuration file.

With this change the CRIU 3.11 feature can be merged into runc with a
test and for the user it should just work, if they are not trying to
change CRIU's log file.

Signed-off-by: Adrian Reber <areber@redhat.com>
2018-12-21 07:42:12 +01:00
Adrian Reber 3763427777 Bump CRIU to 3.11
Upgrade CRIU to 3.11 in the Dockerfile as it includes the patch which
was manually added to fix an error with read-only root containers.

Now that the patch is part of the CRIU 3.11 release this simplifies the
Dockerfile (minimal).

Signed-off-by: Adrian Reber <areber@redhat.com>
2018-11-19 10:08:09 +01:00
Akihiro Suda e389f5757c Dockerfile: update criu to v3.10 + checkpoint-restore/criu@27034e7c
For criu v3.10, a patch is needed for `@test "checkpoint --lazy-pages and restore"`.
Starting with v3.11, the patch will no longer be needed.

The issue had not been caught in Travis because the kernel is too old and the test
had not been executed in Travis.

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2018-08-12 14:05:44 +09:00
Akihiro Suda 39f679c450 travis: test cross compilation
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2018-06-16 09:32:39 +09:00
Andrei Vagin 74e961e2e2 tests: allow to load kernel modules from a test container
CRIU needs to load a few modules to checkpoint/resume containers.

https://github.com/opencontainers/runc/issues/1745
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-03-13 01:20:12 +03:00
Daniel Dao 8be31629cf upgrade criu to v3.7
The current version of criu bundled in dockerfile failed to do checkpoint/restore test on my
system (v4.14.14). Upgrade to latest version v3.7 and also change the
repository name to point to the current official repo.

Signed-off-by: Daniel Dao <dqminh89@gmail.com>
2018-02-26 11:48:39 +00:00
Daniel Dao 121c7b458e upgrade to go 1.10 with debian stretch
This also remove jessie-backport version of libseccomp and just use
stretch bundled version

Signed-off-by: Daniel Dao <dqminh89@gmail.com>
2018-02-26 11:48:11 +00:00
Bin Lu 604dbfbe12 enable integration test on arm64 platform
Currently, integration test can't be done on arm64 platform due to several issues.
 Fix points:
 1, add busybox.tar with arm64 format
 2, add hello-world.tar with arm64 format

Signed-off-by: Bin Lu <bin.lu@arm.com>
2017-11-12 22:43:13 -08:00
Jianyong Wu dc609cc5d1 enable unit test on arm64 platform
Currently, unit test can't be done on arm64 platform
due to multi-arch issue.

Fix points:
golang:1.8.0 doesn't support arm64.
We use golang:1.8 to replace it.

Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
2017-11-03 16:45:52 +08:00
Aleksa Sarai eb5bd4fa6a tests: add tests for rootless multi-mapping configurations
Enable several previously disabled tests (for the idmap execution mode)
for rootless containers, in addition to making all tests use the
additional mappings. At the moment there's no strong need to add any
additional tests purely for rootless_idmap.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2017-09-09 12:45:33 +10:00
Michael Crosby 5930d5b427 Remove shfmt
We don't have that many scripts and for the amount of errors this is
causing on a weekly basis for contributors its not worth the overhead.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-07-06 11:08:44 -07:00
Daniel Dao f8cca79253 criu: update to commit 3ca8e575b49763030d3ddfec4af190a4c9f9deef
CI has fixed kernel version for stack gap bug, updated to
https://github.com/xemul/criu/commit/3ca8e575b49763030d3ddfec4af190a4c9f9deef
which seems to fix the failed tests.

Signed-off-by: Daniel Dao <dqminh89@gmail.com>
2017-06-25 16:10:57 +01:00
Michael Crosby 53ab4f8717 Update criu to 3.1
This updates criu to the latest release to help resolve some of the
issues we are seeing on the CI.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-06-24 15:18:18 +01:00
Andrei Vagin fe03957bca Dockerfile: use CRIU 2.12 for tests
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-05-02 04:48:47 +03:00
Aleksa Sarai ba38383a39 tests: add rootless integration tests
This adds targets for rootless integration tests, as well as all of the
required setup in order to get the tests to run. This includes quite a
few changes, because of a lot of assumptions about things running as
root within the bats scripts (which is not true when setting up rootless
containers).

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2017-03-23 20:46:22 +11:00
Máximo Cuadros e773f96b0e update go version at travis-ci
Signed-off-by: Máximo Cuadros <mcuadros@gmail.com>
2017-02-20 13:15:58 +01:00
Qiang Huang c94bc353ef Bump golang to 1.7.4
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2017-01-12 16:15:39 +08:00
Michal Rostecki 5032f434f3 Clean apt archives and source directories in Dockerfile
Signed-off-by: Michal Rostecki <michal@kinvolk.io>
2016-12-14 23:42:32 +01:00
Aleksa Sarai bda3055055 *: update busybox test rootfs
Switch to the actual source of the official Docker library of images, so
that we have a proper source for the test filesystem. In addition,
update to the latest released version (1.25.0 [2016-06-23]) so that we
can use more up-to-date applets in our tests (such as stat(3)).

This patch is part of the console rewrite patchset.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2016-12-01 15:49:36 +11:00
Daniel Martí b9d13467b9 Add shfmt to the validate make target
We need to run on a directory since shell files might have no extension.
There are few shell files, so speed should not be an issue.

Fixes #1166.
2016-11-17 13:55:59 +00:00
Wang Long 2c74f86e23 Employ jq and state command to make sure that pid-file contains the right information
Signed-off-by: Wang Long <long.wanglong@huawei.com>
2016-10-25 15:48:38 +08:00
Shukui Yang dba9253d2b remove /tmp/bats from dev_runc
Signed-off-by: Shukui Yang <yangshukui@huawei.com>
2016-10-09 09:43:22 +08:00