Commit graph

39 commits

Author SHA1 Message Date
Sebastien Boeuf
c66081eafa test: Make sure to have a running container before calling into "exec"
The test "ctr execsync std{out,err}" from ctr.bats works with runc,
but the semantics behind is wrong.

We should not be able to execute a new process on a container which
has not been previously started. That's why this patch adds a call
to start the container.

Moreover, we don't want to be able to execute a new process on a
container that has already returned because its workload is done.
For that reason, we need to force the container workload to be a
"sleep 10" to ensure it is still running when the call to "exec"
is issued.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2017-06-23 14:08:33 -07:00
Mrunal Patel
db337699f2 test: Tighten the grep for logging with tty
This tests that our ONLCR takes effect as we match \r\n
in the logs

Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-06-21 10:10:16 -07:00
Mrunal Patel
3b3a2929e1 test: Ensure we get error messages back on creation failure
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-06-20 15:07:34 -07:00
Mrunal Patel
784d03809e Merge pull request #530 from runcom/fix-mounts-leak
server: adhere to CRI for sandbox stop/remove
2017-06-16 15:10:41 -07:00
Antonio Murdaca
8b4e3036ea
test: add a test for /etc/resolv.conf in rw/ro mode
This patch isn't adding a test for /etc/hosts as that requires host
network and we don't want to play with host's /etc/hosts when running
make localintegration on our laptops. That may change in the future
moving to some sort of in-container testing.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-06-16 11:01:12 +02:00
Antonio Murdaca
9f68cb4507
server: adhere to CRI for sandbox stop/remove
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-06-15 23:08:30 +02:00
Mrunal Patel
bfd1b83f51 conmon: Modify console terminal settings to match kube settings
We enable ONLCR on the console to match kube's terminal settings.

Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-06-15 07:54:12 -07:00
Antonio Murdaca
65d4ac8fc2
container_create: fix OCI processArgs assemblement
This patch fixes the following command:

kubectl run -i --tty centos --image=centos -- sh

The command above use to fail with:

/usr/bin/sh: /usr/bin/sh: cannot execute binary file

That's because we were wrongly assembling the OCI processArgs.

Thanks @alexlarsson for spotting this.

This patch basically replicates what docker does when merging container
config and image config. It also replicates how docker sets processArgs
for the OCI runtime.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-06-08 11:48:11 +02:00
Antonio Murdaca
ad3a3fcd5a
server: properly format error
`containerdID` is overridden in `s.ctrIDIndex.Get()`, if the ctr is not
found it's overridden by an empty string making the error return
totally unusable.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-28 20:43:01 +02:00
Antonio Murdaca
b9336c74a3
server: correctly fill ctr termination reason
This patch fixes all port forwarding e2e tests. Those tests were
specifically looking for a termination reason to say that a given
container has finished running. CRI-O wasn't actually returning any
reason field for an exited container.

-> https://github.com/kubernetes/kubernetes/blob/master/test/e2e/portforward.go#L116
   -> https://github.com/kubernetes/kubernetes/blob/master/test/utils/conditions.go#L97

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-28 20:14:45 +02:00
Antonio Murdaca
b4251aebd8
execsync: rewrite to fix a bug in conmon
conmon has many flags that are parsed when it's executed, one of them
is "-c". During PR #510 where we vendor latest kube master code,
upstream has changed a test to call a "ctr execsync" with a command of
"sh -c commmand ...".
Turns out:

a) conmon has a "-c" flag which refers to the container name/id
b) the exec command has a "-c" flags but it's for "sh"

That leads to conmon parsing the second "-c" flags from the exec
command causing an error. The executed command looks like:

conmon -c [..other flags..] CONTAINERID -e sh -c echo hello world

This patch rewrites the exec sync code to not pass down to conmon the
exec command via command line. Rather, we're now creating an OCI runtime
process spec in a temp file, pass _the path_ down to conmon, and have
runc exec the command using "runc exec --process
/path/to/process-spec.json CONTAINERID". This is far better in which we
don't need to bother anymore about conflicts with flags in conmon.

Added and fixed some tests also.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-25 22:36:33 +02:00
Mrunal Patel
d06b2ff20f test: Add a test for container OOM
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-05-25 11:30:58 -07:00
Antonio Murdaca
02f3828283
server: workaround images with Config.Volumes
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-22 18:01:06 +02:00
Matthew Heon
d60d3b78ad Fix unit test to use crio/crioctl
The rename to crio missed this test, update it so tests pass

Signed-off-by: Matthew Heon <mheon@redhat.com>
2017-05-15 16:03:05 -04:00
Mrunal Patel
7ea255fcea Merge pull request #495 from rhatdan/rename
Rename ocid to crio
2017-05-15 11:27:28 -07:00
Antonio Murdaca
9b48e83027
test: add caps drop test
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-12 18:20:34 +02:00
Dan Walsh
4493b6f176 Rename ocid to crio.
The ocid project was renamed to CRI-O, months ago, it is time that we moved
all of the code to the new name.  We want to elminate the name ocid from use.
Move fully to crio.

Also cric is being renamed to crioctl for the time being.

Signed-off-by: Dan Walsh <dwalsh@redhat.com>
2017-05-12 09:56:06 -04:00
Mrunal Patel
d3c7a24896 bats: Add a test for adding device to a container
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-05-10 13:36:51 -07:00
Aleksa Sarai
6940313691
test: add tests for split std{err,out}
Now that we have support for split std{out,err}, make sure that execsync
will correctly handle the split stdio properly. In addition, extend the
ctr logging test to make sure that the regular container logging is also
split correctly. We can't test !terminal containers because we only have
a single console for both std{out,err}.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2017-04-12 21:59:25 +10:00
Aleksa Sarai
65527da361
test: add logging tests
The main purpose of these tests is to make sure that the log actually
contains output from the container. We don't test the timestamps or the
stream that's stated at the moment.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2017-04-05 02:45:58 +10:00
Antonio Murdaca
5d86f1f110
test: enable tests in Travis
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-01-19 19:14:46 +01:00
Samuel Ortiz
ce54c1e5e9
test: Do not hardcode runc specific output
"executable file not found in" is part of a runc
specific output when 'runc exec' fails.
This prevents the execsync failure to pass when running
ocid with other runtimes than runc.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2017-01-14 02:02:45 +01:00
Antonio Murdaca
e1054cf28e
cmd/client: move pod create to pod run
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2016-12-14 18:15:37 +01:00
Mrunal Patel
a4021ba179 Merge pull request #235 from runcom/fix-state
server: sync ctr state before checking it
2016-12-06 09:42:43 -08:00
Antonio Murdaca
1b2d4f3d60
server: sync ctr state before checking it
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2016-12-06 12:39:38 +01:00
Antonio Murdaca
f2b4fda554
server: fix ctr filter by truncated id
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2016-12-06 12:16:34 +01:00
Antonio Murdaca
cbe2a68ce5
execsync: return proper error description
The gprc execsync client call doesn't populate `ExecSyncResponse` on
error at all. You just get an error.
This patch modifies the code to include command's streams, exit code
and error direcly into the error. `ocic` will then print useful
infomation in the cli, otherwise it won't.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2016-11-24 12:11:04 +01:00
Mrunal Patel
3e415d0c2f Add test for exec sync
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2016-11-21 13:16:36 -08:00
HaoZhang
018c4db06d add test for container/pod metadata in status/list APIs
Signed-off-by: HaoZhang <crazykev@zju.edu.cn>
2016-11-02 00:37:40 +08:00
Mrunal Patel
e1a4b71478 Add more tests for label filtering
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2016-10-14 12:06:10 -07:00
Mrunal Patel
1d58bc8eae Add a test for label filtering
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2016-10-14 09:58:09 -07:00
Mrunal Patel
1bb79c9bbb Add a test for container list filtering
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2016-10-13 12:40:07 -07:00
Antonio Murdaca
8a9395964e
server/sandbox: fix add/release pod/ctr ids and names
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2016-10-13 18:48:23 +02:00
Antonio Murdaca
9b72f29b72
fixups for tests
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2016-10-08 14:57:45 +02:00
Antonio Murdaca
e0364ec633
add containers restore test
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2016-10-08 14:46:39 +02:00
Aleksa Sarai
498d2d602e
test: add more debugging output
In several places, we previously didn't output the $output of the
failing command, leading to confusion when debugging. A proper fix is to
alias oci{c,d} in helpers.sh like runC does, but that can come later.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2016-10-02 19:13:00 +11:00
Mrunal Patel
23858b7ed6 Add pod list and ctr list calls to ctr lifecycle test
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2016-09-30 12:24:16 -07:00
Mrunal Patel
a2c2d0d6f1 Add container lifecycle test
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2016-09-29 13:33:47 -07:00
Mrunal Patel
52ff9e46dc Add a test for ctr remove
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2016-09-28 12:54:57 -07:00