1
0
mirror of https://github.com/projectatomic/atomic.git synced 2026-02-06 12:45:57 +01:00

197 Commits

Author SHA1 Message Date
Giuseppe Scrivano
6ce51fd4ec tests: skip system containers test if skopeo copy to ostree fails
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1244
Approved by: rhatdan
2018-06-27 13:19:55 +00:00
Giuseppe Scrivano
5a342e32cd docker: restore uninstall when no container name is specified
write_install does not write twice the same container id/name.

Closes: https://github.com/projectatomic/atomic/issues/1217

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1219
Approved by: rhatdan
2018-06-11 18:50:58 +00:00
Giuseppe Scrivano
b9d4ef7a07 tests: skip test_storage.sh if there are no extents available
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1227
Approved by: jlebon
2018-04-18 12:21:20 +00:00
Giuseppe Scrivano
ab5453da97 dockertar-sha256-helper: drop it
it is not used anymore as we completely moved the pull logic to Skopeo.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1215
Approved by: baude
2018-03-24 15:46:55 +00:00
Ruixin Bao
c1676437b2 test: add pull test to verify skopeo
Add 3 cases to verify skopeo pulling from docker to ostree works.

The 3 cases include the following:
1: pull dockertar into ostree (custom name)
2: pull dockertar into ostree (default name)
3: pull docker image into ostree(e.g: docker:image:latest)

Also added a small change to ensure checkout are existant if
no installation of containers happens prior.

Closes: #1180
Approved by: giuseppe
2018-03-02 15:21:32 +00:00
Ruixin Bao
0fc987e8c2 test/syscontainer: relax the virtual size check between images
Before, we used the ostree copy, and the size difference between the
docker image and ostree image is minimal. However, the skopeo way
has a different way of handling image size, making the ostree image has
noticeable size difference compared to the docker image.

Therefore, to make the test pass, we will have a relaxed threshold for
virtual size difference. Since we only have the test check against one
image, we first leave the percent difference to be 4%.

Closes: #1180
Approved by: giuseppe
2018-03-02 15:21:32 +00:00
Giuseppe Scrivano
ca5d43a5fe syscontainers: rebase pulls the image when missing
atomic containers update --rebase=$TO $CONTAINER attempts to pull the
image if it is missing in the repository.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1198
Approved by: rhatdan
2018-02-27 11:33:31 +00:00
Giuseppe Scrivano
df2c209c27 run: add option --runtime
it allows to select a different OCI runtime to use with atomic run.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1196
Approved by: rhatdan
2018-02-23 15:15:05 +00:00
Giuseppe Scrivano
3161e59011 syscontainers: implement "atomic run IMAGE"
if we try "atomic run IMAGE" then the command creates a "oneshot"
container, modifies the args for the config.json file and it runs the
specified command.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1186
Approved by: baude
2018-02-19 16:03:47 +00:00
Giuseppe Scrivano
279d4d4bb3 syscontainers: correctly setup the rootfs SELinux label
The files inside the container are labelled by Skopeo when the image is
pulled to the OSTree storage.

Instead the root directory is created by atomic and by default it gets
the label "unconfined_u:object_r:container_share_t:s0".

Make sure we label the rootfs with the same label of '/'.

We have changed the way files are labelled by Skopeo but we forgot to
change the label for the rootfs created by atomic.  This patch ensures
the SELinux label for the rootfs is set.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1544175

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1185
Approved by: cgwalters
2018-02-15 08:36:09 +00:00
Giuseppe Scrivano
f1d36a2126 syscontainers: allow the container name to end in .[01]
We skipped file names just based on their ending without checking if
it is a symlink.  This prevented container with a name ending in .0 or
.1 to be uninstalled.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1166
Approved by: peterbaouoft
2018-02-01 09:46:58 +00:00
Giuseppe Scrivano
5fcc8051db tests, syscontainers: add tests for useLinks
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1163
Approved by: peterbaouoft
2018-01-25 14:33:37 +00:00
Tomas Tomecek
7179eab364 add support for mounting overlay objects live
using bind-mount

Fixes #1153

Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>

Closes: #1156
Approved by: rhatdan
2018-01-10 19:12:47 +00:00
Giuseppe Scrivano
9218fe0516 containers, update: add --all option
If specified, tries to update all the installed containers.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1136
Approved by: baude
2018-01-04 15:46:33 +00:00
Giuseppe Scrivano
3241b63f67 tests: check copied files have the correct SELinux label
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1143
Approved by: rhatdan
2017-12-18 16:31:48 +00:00
Giuseppe Scrivano
df5dfa9b84 syscontainers: drop check for bwrap-oci
Since we allow to customize the runtime to use, there is no hard
requirement for bwrap-oci anymore.

Also add the same check for system containers, let's error immediately
if the specified runtime is not present.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1141
Approved by: baude
2017-12-15 14:35:27 +00:00
Giuseppe Scrivano
0ce66a038d syscontainers: do not delete modified files with --system-package=no
Store the checksum of files copied to the host, so that on an update or
an uninstall we can skip the files that have a mismatch in the
checksum.

This reflects in the --system-package=no case what the rpm backend
already does.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1131
Approved by: ashcrow
2017-11-27 16:36:34 +00:00
Giuseppe Scrivano
0999b88404 mount: drop prefixes from the ostree image
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1127
Approved by: ashcrow
2017-11-14 15:40:58 +00:00
Giuseppe Scrivano
e78ecdd216 install: add new option --runtime=PATH to choose the OCI runtime
it is supported by system and user containers.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1125
Approved by: TomSweeneyRedHat
2017-11-14 10:27:00 +00:00
Jonathan Lebon
a955fb8a6d tests/storage: check for grep failure
Split the pipeline in two so that we check that there's something to
unmount before doing it. This is needed now because the new CI
infrastructure provisions a true uninitialized block device that doesn't
need to be unmounted, so the `grep` would fail (because of the
`pipefail` option). Previously, `/dev/vdb` was actually itself a
pre-formatted ext4 partition and thus was automounted.

This should now catch both the old CI style (in case local developers
were mirroring that setup), as well as more conventional partitioning
schemes.

I dropped the `-r` since we *know* at that point that there is at least
one entry to unmount.

Closes: #1106
Approved by: rhatdan
2017-10-12 14:26:37 +00:00
Giuseppe Scrivano
47478024dc syscontainers: create empty directories in the .rpm case
We already do this when copying directly to the host.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1104
Approved by: ashcrow
2017-09-25 20:25:46 +00:00
Giuseppe Scrivano
4a5de16cdc tests: integration tests for 'run' with system containers
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1075
Approved by: ashcrow
2017-08-29 07:11:54 +00:00
Yu Qi Zhang
14e878dbfc Fix tests for f26
Fix test failures after updating papr to test with f26 atomic/cloud
images instead of f25, with the following changes:

1. Remove dependency on docker hub tester image. Instead, mimic
what ostree/rpm-ostree does and use a recursive .papr.sh script
to install the necessary packages to the base f26 image in the
fedora registry. This fixes tests on the atomic host since python3.6
is being used, and prevents future tests from testing the wrong
version. (Note this is slightly slower due to having to install
packages during the test rather than using a pre-built image).

2. Fix some pylint errors, and mask others for now

3. Fix failing integration tests due to inter-test interference

4. Remove unnecessary deepcopy in container filter

5. Add compatibility for both c-s-s and d-s-s in storage

6. Update expected sha256 values for dockertar test

Remaining issues:

1. test_storage should possibly be reworked. The current test
setup is conflicting with the new default of overlay as a driver.
For now, the test for generated d-s-s is disabled.

2. some storage commands are still using "docker-storage-setup"
instead of "container-storage-setup". There is a backward
compatible check in place that should be reworked in the future

3. some masked pylint errors should be further investigated

4. keep the dockerfile for the project atomic tester image for now
(bump to 26), since its a little easier and faster to set up with

Signed-off-by: Yu Qi Zhang <jerzhang@redhat.com>

Closes: #1076
Approved by: baude
2017-08-23 18:33:48 +00:00
baude
64843d3e84 Fix Python3 issues for F26
Several tests failed (as reported in issues #1057) on Fedora 26.

Closes: #1060
Approved by: rhatdan
2017-08-07 17:45:45 +00:00
Giuseppe Scrivano
f3c6b8bb74 uninstall: inhibit UNINSTALL if there are running containers
Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1456451

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1050
Approved by: rhatdan
2017-07-18 21:48:46 +00:00
Petr Kubat
62cae10482 tests: add test for table preprocessing
Signed-off-by: Petr Kubat <pkubat@redhat.com>

Closes: #1044
Approved by: giuseppe
2017-07-13 09:55:48 +00:00
Giuseppe Scrivano
890d0e779b test_system_containers_images.sh: make test clearer
move the filter inside the Python script since the
"images -f" can include other results and make the comparison fail only
if the difference between the two sizes is > 1%.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1047
Approved by: TomasTomecek
2017-07-13 08:14:14 +00:00
Brent Baude
2c9aae9873 Atomic/containers.py: Add NAME field to container list
Issue #1021 requested we add the NAME field to the containers list command,
so that debugging container failures would be easier.

Closes: #1024
Approved by: baude
2017-06-29 18:35:25 +00:00
Brent Baude
69f6d52370 Atomic/install.py: Don't write the install data if the install fails
A bug was reported in issue #1022 where if the atomic install data failed,
the installation data was still written allowing the user to proceed
with an atomic run.

Disabling test_install.sh until i can follow up with Thomas.

Closes: #1025
Approved by: baude
2017-06-21 20:09:14 +00:00
Ruixin Bao
a33431fb68 Fix the _mark_used function to identify image as being used
When image is being referenced by a container,
_mark_used function should mark image as being
used if the image id is found inside the information of
containers.

In this case, the image id for containers should be
referenced as container.image instead of container.id

Some tests are added for future regression.

Closes: #1030
Approved by: baude
2017-06-20 16:33:52 +00:00
Giuseppe Scrivano
91f1e1621d tests: check virtual size is correct for syscontainers
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1029
Approved by: baude
2017-06-14 16:51:23 +00:00
Yu Qi Zhang
83ffa44ca2 Fix multiple images filters
Multiple filters should be handled as AND, not OR.

Signed-off-by: Yu Qi Zhang <jerzhang@redhat.com>

Closes: #1031
Approved by: giuseppe
2017-06-14 14:53:53 +00:00
Brent Baude
2dfeae1356 Atomic/backends/_docker.py: Error prevention with atomic run
There were two primary cases where a secondary atomic run with a command
would trigger an exception.  The first was reported in
https://github.com/projectatomic/atomic/issues/1006. Basically it can
be summarized as:

```
atomic run registry.fedoraproject.org/fedora:25 date  # works fine
atomic run registry.fedoraproject.org/fedora:26 date  # tries to run in the existing f25 container
```

The second case is as simple as:

```
atomic run registry.fedoraproject.org/fedora:25 date  # works fine
atomic run registry.fedoraproject.org/fedora:25 date  # fails
```

This fails because atomic starts the stopped f25 container and then attempts a docker exec.  The
exec fails because the 'date' command is short-lived and the container exits prior to the exec
being run.

We now catch those exceptions and notify the user.  We added a `--replace` option to run where
atomic will now delete the container in question and re-run it from the correct image.

Closes: #1019
Approved by: baude
2017-05-31 19:20:25 +00:00
Yu Qi Zhang
3db0e41043 Add test_images_list.sh
Add integration tests for `atomic images list` functionality.

Signed-off-by: Yu Qi Zhang <jerzhang@redhat.com>

Closes: #1017
Approved by: baude
2017-05-31 16:22:55 +00:00
Yu Qi Zhang
ad99e64804 Fix test_tag.sh
Add tests to check that the tags are being properly displayed,
and remove duplicate ostree image tagging tests that are in
test_system_container_images.sh

Signed-off-by: Yu Qi Zhang <jerzhang@redhat.com>

Closes: #1017
Approved by: baude
2017-05-31 16:22:55 +00:00
Steve Milner
1359575e76 Atomic/containers.py: Always return json when requested
When atomic containers list --json ... is used the result should always
be valid json. In the event there are no containers returned an empty
json list is expected.

Closes: #1016
Approved by: baude
2017-05-31 15:57:25 +00:00
Giuseppe Scrivano
19a6da48cb tests: skip rpm installation on Atomic Host
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1005
Approved by: rhatdan
2017-05-30 19:41:33 +00:00
Giuseppe Scrivano
763b9d665b tests: adjust the .rpm name
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1005
Approved by: rhatdan
2017-05-30 19:41:33 +00:00
Giuseppe Scrivano
6864d6eaf8 tests: drop check for rpmbuild
Since we don't use it anymore, run all the tests

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1005
Approved by: rhatdan
2017-05-30 19:41:33 +00:00
Brent Baude
45ff2fdd0b Atomic/tag.py: Fix tag to work with dockerd, invalid images BZ #1454656
The atomic tag function was not working correctly for docker images
in the dockerd.  Also, when attempting to tag an image from one
backend into another, we didn't handle the error correctly.  This should
not work.

Add integration tests for tagging invalid images, dockerd, and ostree.

This should fix BZ #1454656.

Closes: #1014
Approved by: baude
2017-05-25 13:40:44 +00:00
Brent Baude
b829264e1b tests/integration/test_storage.sh
Use findmnt to detect mounts.

Closes: #1008
Approved by: baude
2017-05-18 20:42:19 +00:00
Steve Milner
d4fd659dc2 test: Disable test_storage.sh
test_storage.sh is erroring on centos_atomic with the following:

    error: /dev/vdb: probing initialization failed: Device or resource
    busy

A few quick attempts to fix it were made, but ended up failing.
Disabling (by appending an underscore) the test until it can be
investigate further.

Closes: #1007
Approved by: baude
2017-05-18 19:56:16 +00:00
Brent Baude
85596a06e9 Add integration test for uninstall
Use the --display switch for uninstall and match the UNINSTALL
label to a result.

Closes: #989
Approved by: rhatdan
2017-05-10 13:07:00 +00:00
Yu Qi Zhang
91479834d0 Fix container/image filters
Fix --quiet and --no-trunc not working together for "images list"
and "containers list".

Signed-off-by: Yu Qi Zhang <jerzhang@redhat.com>

Closes: #992
Approved by: giuseppe
2017-05-09 20:39:20 +00:00
Tomas Tomecek
532787bcbe help: prefer help file over label
Fixes #939

Reference: https://pagure.io/atomic-wg/issue/256#comment-436537

* The command now prefers files over "help" label.
 * Help files can be one of:
  * help.1, README.md

Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>

Closes: #941
Approved by: rhatdan
2017-05-09 15:00:50 +00:00
Yu Qi Zhang
c9921db260 Refactor system container tests
The old tests (test_system_containers.sh) were disorganized
and lacked coverage for many commands. This refactor attempts
to improve the tests with a focus on clarity and coverage.

Improvements:
  - split into 4 separate tests for clarity and independence
  - section each test to better know where failures happen
  - make use of shared setup functions
  - use ${WORK_DIR} for test files
  - better setup/teardown usage
  - improved coverage for update/rollback, image commands,
    environment variables and expected failures

Drawback:
  - Slower

Signed-off-by: Yu Qi Zhang <jerzhang@redhat.com>

Closes: #983
Approved by: giuseppe
2017-05-03 15:59:16 +00:00
Tomas Tomecek
e93b8319ad implement install --storage=docker --system-package=yes
Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>

Closes: #955
Approved by: baude
2017-04-28 22:52:40 +00:00
Tomas Tomecek
805b955ed5 mount: create context manager for {Docker,OSTree}Mount
Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>

Closes: #976
Approved by: rhatdan
2017-04-24 20:29:15 +00:00
Brent Baude
4eaab31ccb Add integrations tests for atomic_dbus_client.py
We need to make sure the atomic_dbus_client code works and if something
in atomic_dbus.py changes, the client should either be updated or still
work.

Closes: #975
Approved by: rhatdan
2017-04-21 20:12:06 +00:00
Brent Baude
3c273e4ad2 Atomic/install.py: Fix what c134ee5 broke
The commit c134ee5 broke the ability for atomic install to pull an image
if it isnt present.

Also, changed the flow in install.py to use more of the backend
objects when determining the backend, the image object, and the
remote image objects.

Closes: #973
Approved by: rhatdan
2017-04-20 13:47:04 +00:00