Commit Graph

98 Commits

Author SHA1 Message Date
Mrunal Patel beb8716fcb Merge pull request #1528 from leitwolf7/fix-integration
make localintegration fails on Ubuntu 17.04
2017-10-10 12:41:40 -07:00
Konstantinos Karampogias 605dc5c811 Set initial console size based on process spec
Signed-off-by: Will Martin <wmartin@pivotal.io>
Signed-off-by: Petar Petrov <pppepito86@gmail.com>
Signed-off-by: Ed King <eking@pivotal.io>
Signed-off-by: Roberto Jimenez Sanchez <jszroberto@gmail.com>
Signed-off-by: Thomas Godkin <tgodkin@pivotal.io>
2017-10-04 12:32:16 +01:00
leitwolf7 e6e2439261 Merge branch 'master' into fix-integration 2017-09-21 22:25:58 +02:00
Mrunal Patel d5b43c3981 Merge pull request #1455 from dqminh/epoll-io
tty: move IO of master pty to be done with epoll
2017-09-11 11:32:42 -07: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
Aleksa Sarai d0aec23c7e
tests: generalise rootless runner
This is necessary in order to add proper opportunistic tests, and is a
placeholder until we add tests for new{uid,gid}map configurations.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2017-09-09 12:45:33 +10:00
Adrian Reber ec260653b7 lazy-migration: add test case
The lazy-pages test case is not as straight forward as the other test
cases. This is related to the fact that restoring requires a different
name if restored on the same host. During 'runc checkpoint' the
container is not destroyed before all memory pages have been transferred
to the destination and thus the same container name cannot be used.

As real world usage will rather migrate a container from one system to
another than lazy migrate a container on the same host this is only
problematic for this test case.

Another reason is that it requires starting 'runc checkpoint' and 'criu
lazy-pages' in the background as those process need to be running to
start the final restore 'runc restore'.

CRIU upstream is currently discussing to automatically start 'criu
lazy-pages' which would simplify the lazy-pages test case a bit.

The handling and checking of the background processes make the test case
not the most elegant as at one point a 'sleep 2' is required to make
sure that 'runc checkpoint' had time to do its thing before looking at
log files.

Before running the actual test criu is called in feature checking mode
to make sure lazy migration is in the test case criu enabled. If not,
the test is skipped.

Signed-off-by: Adrian Reber <areber@redhat.com>
2017-09-06 12:35:39 +00:00
Daniel Dao 91eafcbc65
tty: move IO of master pty to be done with epoll
This moves all console code to use github.com/containerd/console library to
handle console I/O. Also move to use EpollConsole by default when user requests
a terminal so we can still cope when the other side temporarily goes away.

Signed-off-by: Daniel Dao <dqminh89@gmail.com>
2017-07-28 12:35:02 +01:00
leitwolf7 9c36ffbcb5 make localintegration fails on Ubuntu 17.04
Fix 2 string comparision issues in output validation.

Signed-off-by: leitwolf7 <leitwolf@wolke7.net>
2017-07-19 16:12:19 -04:00
Zhang Wei 9192b052b2 Fix integration when missing criu
If criu isn't installed in the host, integration tests won't be able
to go on, it should skip checkpoint/restore tests instead of interrupt.

Output before:

```
$ make localintegration
bats -t tests/integration
/usr/lib/bats/bats-exec-suite: line 20: let: count+=: syntax error:
operand expected (error token is "+=")
Makefile:103: recipe for target 'localintegration' failed
```

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2017-07-14 20:15:20 +08:00
Daniel Dao 900f6f46e1
print out errors in checkpoint/restore log
print out errors in checkpoint/restore log when it failed similar to how we did i
in `checkpoint --pre-dump` tests

Signed-off-by: Daniel Dao <dqminh89@gmail.com>
2017-06-25 16:01:36 +01:00
Andrei Vagin 76d87976d9 tests: remove wait_for_container from checkpoint.bats
It isn't required there, all operations what are called are synchronous.

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-06-10 02:50:45 +03:00
Andrei Vagin a541df7cb7 tests: redirect runc log message to stderr
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-06-10 02:50:45 +03:00
Michael Crosby 854b41d81e Update spec to 239c4e44f2
This provides updates to runc for the spec changes with *Process and
OOMScoreAdj

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-06-01 16:29:47 -07:00
Christy Perez 9ed7e9b176 shfmt'ing files
Signed-off-by: Christy Perez <christy@linux.vnet.ibm.com>
2017-05-24 16:43:08 -05:00
Mrunal Patel 639454475c Merge pull request #1355 from avagin/cr-console
Dump and restore containers with external terminals
2017-05-18 11:22:52 -07:00
Antonio Murdaca d1a743674a
Ignore error when force deleting a non-existing container
This patch mimics the behavior of "rm -rf" so that if a container
doesn't exist and you force delete it, it won't error out.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-16 22:23:00 +02:00
Andrei Vagin a9e15e7e07 criu: check that stdout, stdin pipes are restore correctly
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-05-03 00:55:24 +03:00
Andrei Vagin abd0515816 tests: don't call wait_for_container after synchronous operations
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-05-02 21:48:07 +03:00
Andrei Vagin 459a17b838 test: check C/R for a container with an external terminal
We have two test cases with and without pre-dump. Terminals and
pre-dump features are orthogonal, so we can modify one of these test cases.

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-05-02 04:48:47 +03:00
Kenfe-Mickael Laventure 1e7e276aff Allow updating container pids limit
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-04-28 06:44:44 -07:00
Aleksa Sarai d9807ae420
vendor: clean up to be better written
vndr doesn't support non-top-level imports, and in addition we really
should be using tagged releases far more than we currently are
(*especially* when it come to the OCI specs).

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2017-04-25 10:46:48 +10: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
Aleksa Sarai 2ce33574d0
integration: added root requires
This is in preperation of allowing us to run the integration test suite
on rootless containers.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2017-03-23 20:46:21 +11:00
Qiang Huang e0c7b6ceb7 Only allow single container operation
As per the discussions in #1156 , we think it's a bad
idea to allow multi container operations in runc. So
revert it.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2017-03-08 10:02:39 +08:00
Qiang Huang cf883a87e7 Merge pull request #1340 from dqminh/vndr-take2
Carry #998: Use vndr tool for vendoring
2017-02-24 21:48:51 -08:00
Qiang Huang 707dd48b2f Merge pull request #1001 from x1022as/predump
add pre-dump and parent-path to checkpoint
2017-02-24 10:55:06 -08:00
Alexander Morozov 993cbf9db0
move from Godeps to vndr
This uses the standard go vendor location instead of old Godeps
location.

Also remove usage of symlink GOPATH. Since our README mentions that you
should build it inside GOPATH, i think its a reasonable to assume that
you dont need to create a tmp GOPATH.

Signed-off-by: Daniel Dao <dqminh89@gmail.com>
2017-02-24 11:25:21 +00:00
Mohammad Arab 18ebc51b3c Reset Swap when memory is set to unlimited (-1)
Kernel validation fails if memory set to -1 which is unlimited but
swap is not set so.

Signed-off-by: Mohammad Arab <boynux@gmail.com>
2017-02-15 08:11:57 +01:00
Deng Guangxing 98f004182b add pre-dump and parent-path to checkpoint
CRIU gets pre-dump to complete iterative migration.
pre-dump saves process memory info only. And it need parent-path
to specify the former memory files.

This patch add pre-dump and parent-path arguments to runc checkpoint

Signed-off-by: Deng Guangxing <dengguangxing@huawei.com>
Signed-off-by: Adrian Reber <areber@redhat.com>
2017-02-14 19:45:07 +08:00
Zhang Wei 51baedf3f3 Add integration for update rt period and runtime
Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2016-12-27 17:57:13 +08:00
Aleksa Sarai b0fc85e99d
tests: add tty bats integration
Add some tests to ensure that we always get a proper console (created
inside the container). This is done by checking that the
/proc/self/fd/[012] "symlinks" are always referencing something in
/dev/pts/*.

This patch is part of the console rewrite patchset.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2016-12-01 15:49:37 +11:00
Aleksa Sarai 972c176ae4
tests: fix all the things
This fixes all of the tests that were broken as part of the console
rewrite. This includes fixing the integration tests that used TTY
handling inside libcontainer, as well as the bats integration tests that
needed to be rewritten to use recvtty (as they rely on detached
containers that are running).

This patch is part of the console rewrite patchset.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2016-12-01 15:49:37 +11: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í cdb66f5421 Run shfmt on all shell files 2016-11-17 11:51:12 +00:00
Mrunal Patel 188312013f Merge pull request #1128 from datawolf/exec-with-pid-file
fix the pid-file option for runc exec/run/create command
2016-11-10 22:39:42 +00:00
rajasec 2b62358140 Adding update command in help-bats
Signed-off-by: rajasec <rajasec79@gmail.com>
2016-11-07 14:43:55 +05:30
Qiang Huang e3ba943b6d Merge pull request #1173 from WeiZhang555/update-rt-resources
Allow update rt_period_us and rt_runtime_us
2016-11-07 11:05:45 +08:00
Zhang Wei 6cd425be2b Allow update rt_period_us and rt_runtime_us
Currently runc already supports setting realtime runtime and period
before container processes start, this commit will add update support
for realtime scheduler resources.

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2016-11-04 18:57:22 +08:00
Wang Long d5525cc38d add test cases for exec command
This patch add test `--cwd`, `--env`, `--user` option for exec command.

Signed-off-by: Wang Long <long.wanglong@huawei.com>
2016-11-04 14:15:47 +08:00
Wang Long 8676c75442 Fix the pid-file option for runc run/exec/create command
Signed-off-by: Wang Long <long.wanglong@huawei.com>
2016-11-02 14:08:32 +08:00
Qiang Huang b15668b36d Fix all typos found by misspell
I use the same tool (https://github.com/client9/misspell)
as Daniel used a few days ago, don't why he missed these
typos at that time.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2016-10-29 14:14:42 +08: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
Qiang Huang 850b9c0b50 Merge pull request #1132 from datawolf/add-integration-test-for-create
add test cases for create command
2016-10-22 17:46:33 +08:00
Wang Long 5aef160c5a add test cases for list command
This patch add test `-q` option for list command.

Signed-off-by: Wang Long <long.wanglong@huawei.com>
2016-10-20 16:45:34 +08:00
Wang Long 596a4c397c add test cases for create command
This patch add test `--pid-file` option for create command.

Signed-off-by: Wang Long <long.wanglong@huawei.com>
2016-10-20 16:23:27 +08:00
Aleksa Sarai 6e97f3ad69
tests: mask: use test paths rather than /sys
In certain circumstances (such as the rootless containers patchset), it
is not possible to test things using /sys/firmware. In addition, we
should be testing our own functionality rather than testing protection
against /sys attacks (for which the system might already have extra
protections).

Instead, just make some fake paths in the rootfs that we then mask.
Oddly I noticed that one of the errors changed when doing this (because
before we tested removing a file from /sys/firmware which is -EPERM). So
the old test was broken.

Fixes: 53179559a1 ("MaskPaths: support directory")
Fixes: #1068
Signed-off-by: Aleksa Sarai <asarai@suse.de>
2016-10-19 05:59:50 +11:00
Michael Crosby 4dcc0466e2 Merge pull request #1074 from datawolf/multi-containers
start multi-containers with `runc start` command
2016-10-17 14:31:04 -07:00
Wang Long 2f5c0afbbc pause and resume multi-containers
With this patch, `runc pasue` and `runc resume` can
pause and resume multi-containers.

Signed-off-by: Wang Long <long.wanglong@huawei.com>
2016-10-17 19:44:08 +08:00
Wang Long 74bfe500e4 start mulit-containers with `runc start` command
With this patch, `runc start` command can start mulit-containers
at one command this patch also checks the argument of the `start`
command.

root@ubuntu:# runc list
ID          PID         STATUS      BUNDLE         CREATED
a           0           stopped     /mycontainer   2016-09-23T08:56:42.754026567Z
b           62979       created     /mycontainer   2016-09-23T09:01:36.421976458Z
c           62993       running     /mycontainer   2016-09-23T09:01:38.105940389Z
d           63006       created     /mycontainer   2016-09-23T09:01:39.65441942Z
e           63020       created     /mycontainer   2016-09-23T09:01:40.989995515Z
root@ubuntu:# runc start
runc: "start" requires a minimum of 1 argument
root@ubuntu:# runc start a b c d e f
cannot start a container that has run and stopped
cannot start an already running container
container f is not exist
all or part of the containers start failed
root@ubuntu:# runc list
ID          PID         STATUS      BUNDLE         CREATED
a           0           stopped     /mycontainer   2016-09-23T08:56:42.754026567Z
b           62979       running     /mycontainer   2016-09-23T09:01:36.421976458Z
c           62993       running     /mycontainer   2016-09-23T09:01:38.105940389Z
d           63006       running     /mycontainer   2016-09-23T09:01:39.65441942Z
e           63020       running     /mycontainer   2016-09-23T09:01:40.989995515Z

Signed-off-by: Wang Long <long.wanglong@huawei.com>
2016-10-08 11:57:25 +08:00