Commit Graph

63 Commits

Author SHA1 Message Date
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
Qiang Huang 98afb7390a Add integration test for ps command
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2016-09-29 18:33:32 +08:00
Qiang Huang d9fec4c63b Merge pull request #1065 from keloyang/remove-ps-workaround
Remove the workaround which add a -- flag to runc ps command
2016-09-28 17:09:58 +08:00
Qiang Huang 2940d2e2e9 Merge pull request #1069 from datawolf/add-unittest
[integration] add testcases for `runc delete` command
2016-09-27 19:20:36 +08:00
Shukui Yang cc0e2d567f Remove the workaround which add a -- flag to runc exec command and add integration for exec ls -la
Signed-off-by: Shukui Yang <yangshukui@huawei.com>
2016-09-24 12:21:50 +08:00
Shukui Yang 993126259c Remove the workaround which add a -- flag to runc ps command and add integration for ps -eaf
Signed-off-by: Shukui Yang <yangshukui@huawei.com>
2016-09-24 12:20:52 +08:00
Akihiro Suda 53179559a1 MaskPaths: support directory
For example, the /sys/firmware directory should be masked because it can contain some sensitive files:
  - /sys/firmware/acpi/tables/{SLIC,MSDM}: Windows license information:
  - /sys/firmware/ibft/target0/chap-secret: iSCSI CHAP secret

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2016-09-23 16:14:41 +00:00
Wang Long e72a4e5bd2 [integration] add testcases for `runc delete` command
this patch add two testcases for the `runc delete` with
multi-containers. see : https://github.com/opencontainers/runc/pull/1053

Signed-off-by: Wang Long <long.wanglong@huawei.com>
2016-09-23 15:35:50 +08:00
Qiang Huang a2a6e828a9 Merge pull request #1048 from crosbymichael/state-json
Use same state object for state and list
2016-09-22 19:48:43 +08:00
Mrunal Patel ce5d8cf941 Merge pull request #1056 from datawolf/remove-duplicate-test
remove duplicate test command on integration
2016-09-20 09:57:39 -07:00
Michael Crosby 4350d90043 Use same state object for state and list
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-09-19 09:18:24 -07:00
Wang Long d852210a7e remove duplicate test command on integration
Signed-off-by: Wang Long <long.wanglong@huawei.com>
2016-09-19 11:18:38 +00:00
Qiang Huang c5d33b1ac7 Fix update cpuset on single processor box
Fixes: #1050

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2016-09-18 10:44:46 +08:00
Adam Thomason 98727fbb63 Update spec config path
Tracks schema/schema.json → schema/config-schema.json rename in
59ede1a6ac

Signed-off-by: Adam Thomason <ad@mthomason.net>
2016-09-11 16:48:12 -07:00
Aleksa Sarai 91ff092487 Merge pull request #972 from brauner/2016-08-05/add_requires_for_cgroups_kmem
tests: add requires cgroups_kmem
2016-08-12 18:50:59 +10:00
Christian Brauner 7c59766049
tests: add requires cgroups_kmem
On older kernels or kernels were CONFIG_MEMCG_KMEM is not set some cgroup tests
cannot be run. We simply test for the existence of the file
"${CGROUP_BASE_PATH}/memory/memory.kmem.limit_in_bytes" which should be
sufficient to conclude that CONFIG_MEMCG_KMEM is not set.

Signed-off-by: Christian Brauner <cbrauner@suse.de>
2016-08-10 15:17:22 +02:00
Qiang Huang 75f765e961 Use absolute cgroup path for integration test
So we can pass the test in container os local or systemd
environment.

Also fixes: #967

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2016-08-07 10:47:09 +08:00
Johnny Bieren 2448451a18 Change git -C reset to git reset w/ wking suggestion. fix indentation
Signed-off-by: Johnny Bieren <jbieren@redhat.com>
2016-07-26 09:22:14 -04:00
Kenfe-Mickael Laventure 9fc9d10e57 Add `--force` flag to `runc delete`
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2016-06-30 07:55:44 -07:00
Aleksa Sarai c77eb1c413 tests: add tests with {u,g}id != 0
This is a very important testcase, as certain permission issues can
arise if we don't test this automatically.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2016-06-18 12:16:42 +10:00
Mrunal Patel 96c15e6e3c Merge pull request #889 from cyphar/tests-provide-debug
tests: add debug information for failing tests
2016-06-13 16:04:44 -07:00
Mrunal Patel 10d7cfb50e bats: Fix spec validation test
Use the commit that we have in Godeps.json rather than relying on
runtime-spec HEAD

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2016-06-09 13:16:00 -07:00
Aleksa Sarai 7222ba6587 tests: add debug information for failing tests
bats doesn't automatically print the entirety of $output when an error
has occurred in a test. This makes debugging much harder, so add to the
runc wrapper some more debug information to make maintainers' lives
easier.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2016-06-07 18:52:20 +10:00
rajasec 0307c88ee9 Updating README for starting the container
Signed-off-by: rajasec <rajasec79@gmail.com>

Updating README for starting the container

Signed-off-by: rajasec <rajasec79@gmail.com>

Updating README files for container start

Signed-off-by: rajasec <rajasec79@gmail.com>

updating README files for container start

Signed-off-by: rajasec <rajasec79@gmail.com>
2016-06-05 14:41:58 +05:30
Michael Crosby c5060ff303 Merge pull request #827 from crosbymichael/create-start
Implement create and start
2016-06-03 10:38:03 -07:00
Michael Crosby 1d61abea46 Allow delete of created container
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-06-02 12:26:12 -07:00
Michael Crosby 06fab0f860 Add integration tests for create/start
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-05-31 11:10:47 -07:00
Michael Crosby efcd73fb5b Fix signal handling for unit tests
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-05-31 11:10:47 -07:00
Michael Crosby 75fb70be01 Rename start to run
`runc run` is the command that will create and start a container in one
single command.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-05-31 11:06:41 -07:00
Qiang Huang 71511dc155 Improve update memory
Support update memory with:
runc update --memory 50M container-id

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2016-05-30 18:56:10 +08:00
Aleksa Sarai 72ee54918f integration: add requires() function
This is similar to the testRequires() function in the Docker test suite.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2016-05-26 19:17:39 +10:00
Aleksa Sarai 4fd8a7aafa bats: refactor run "$RUNC" -> runc
This makes it much simpler to write tests, and you don't have to worry
about some of the oddness with bats.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2016-05-26 19:17:39 +10:00
Mrunal Patel aa7e27eac9 Merge pull request #828 from hqhq/hq_fix_update_kmem
Fix update kernel memory test
2016-05-24 09:58:09 -07:00