Commit Graph

39 Commits

Author SHA1 Message Date
Sascha Grunert 3f5ae4b433
Add integration tests for images with a lot of layers
As a follow-up of #489 we now add an integration test which adds an
image with a decent amount of layers.

Signed-off-by: Sascha Grunert <sgrunert@suse.com>
2019-12-10 15:47:14 +01:00
Giuseppe Scrivano 7a0d58dab5
storage: drop ostree deduplication
it was an attempt to use OSTree to deduplicate files, at the time we
already had a dependency on OSTree for system containers in
containers/image.  Since the feature never really took off, let's just
drop it.

Closes: https://github.com/containers/storage/issues/419

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-10-05 20:27:45 +02:00
Daniel J Walsh 45d208f3af
Merge pull request #436 from nalind/enobigdata
ImageBigData: distinguish between no-such-image and no-such-item
2019-09-27 07:47:11 +02:00
Nalin Dahyabhai 2a6b234dd4 ImageBigData: distinguish between no-such-image and no-such-item
When reporting an error from store.ImageBigData(), distinguish between
cases where we can't find the specified image, and where we found the
image, but it didn't have a matching requested item.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2019-09-25 10:41:49 -04:00
Nalin Dahyabhai b5a276ea64 ImageSize: don't get tripped up by images with no layers
Images don't have to have layers, so they don't have to have top layers,
and we shouldn't return an error when attempting to determine the size
of such an image.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2019-09-25 10:27:01 -04:00
Nalin Dahyabhai bcedb54d05 layerStore.Load(): don't try to lock the mounts list on cleanup
When cleaning up an incomplete layer, don't call regular Delete() to
handle it, since that calls Save(), which tries to lock the mountpoints
list, which we've already obtained a lock over.  Add a variation on
Delete() that skips the Save() step, which we're about to do anyway, and
call that instead.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2019-09-12 11:17:54 -04:00
Sascha Grunert 66c879f02a
Switch to golangci-lint
This commit uses internal tools vendoring to switch to golangci-lint. All
working linters have been enabled. The other tools have been vendored as
well into the same tools folder, whereas the corresponding test and
build targets have been adapted as well.

Signed-off-by: Sascha Grunert <sgrunert@suse.com>
2019-07-17 11:13:06 +02:00
Nalin Dahyabhai 2bfb2b5b41 Add tests for the ReadOnly field
Check that layers and images in read-only stores are correctly marked as
such.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2019-05-21 11:54:50 -04:00
Giuseppe Scrivano 91828c80e1
tests: disable idmaps test with mount_program
disable these tests when using fuse-overlayfs.  fuse-overlayfs has
support for IDs shifting, so it will end up to cancel the effect of
these tests.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-05-15 17:04:02 +02:00
Nalin Dahyabhai 9a4328ef7c tests: check that we update last-writers when changing things
Make sure that the appropriate lock file's contents (the last-writer ID)
actually gets updated when we create layers, images, and containers.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2019-05-08 14:40:49 -04:00
Nalin Dahyabhai 85c846a2bb tests: test layerless images
Test creation of images without layers, and containers based on them.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2019-05-07 16:21:04 -04:00
Daniel J Walsh e3394b6beb
Fix handling of additional stores
When you build an image with a parent layer in read-only stores
and the new image in read/write stores, the first time you try
to create a container based on the image, it fails, since it
cannot find the image in the same store.

This patch looks not only in the same store, but all of the stores
available.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-04-19 04:36:07 -04:00
Nalin Dahyabhai b41a2a8b83 Drop our dependency on github.com/containers/image
Drop our dependency on the image library's manifest package by requiring
that callers pass its Digest() function to us as a callback.  This makes
our CLI test/diagnostic tool calculate digests of s1 manifests
incorrectly, but that's not something that we were testing.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2019-03-06 15:06:34 -05:00
Nalin Dahyabhai f61b77479f abs.bats: don't forget to shut things down after the test
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2019-02-26 14:19:15 -05:00
Nalin Dahyabhai f082271ea3 stores.bats: hard fail if we unexpected can't use read-only stores
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2019-02-26 14:19:15 -05:00
Nalin Dahyabhai 6d609d1042 GetStore(): resolve passed-in paths to absolute paths
Resolve passed-in locations to absolute paths at startup.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2019-02-18 11:23:05 -05:00
Nalin Dahyabhai ccf8bef6fa Teach images to hold multiple manifests
Change how we compute digests for BigData items with names that start
with "manifest" so that we use the image library's manifest.Digest()
function, which knows how to preprocess schema1 manifests to get the
right value, instead of just trying to finesse it.

Track the digests of multiple manifest-named items for images.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2019-02-07 10:27:36 -05:00
Nalin Dahyabhai 488134ff6a image-by-digest.bats: print output
Display the output from commands before we check their exit status, so
that we can see what they output if a check fails.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2019-02-06 10:04:37 -05:00
Nalin Dahyabhai bea7c4cf3d idmaps.bats: for shifting tests, always turn on shifting
Set _TEST_FORCE_SUPPORT_SHIFTING=yes-please for all of the invocations
of the storage helper when we're testing that feature.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2018-12-06 13:50:38 -05:00
Nalin Dahyabhai 97363a8fe3 test_drivers.bash: check for binaries that the driver expects
Skip devicemapper tests if binaries that it expects to find aren't
present.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2018-12-06 13:50:38 -05:00
Nalin Dahyabhai 364b07aba9 idmaps.bats: skip more tests for aufs
ID mapping is only implemented for a basic drivers and overlay, so we
shouldn't be attempting to test it with aufs.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2018-12-06 13:50:38 -05:00
Daniel J Walsh ab6be50561
Allow the passing in and retrieval of mount options
We want to allow tools like podman/buildah to override default storage
container mount options on a container by container basis.

For example if the default mount options for containers/storage include
nodev or nosuid, we want to allow podman to turn these off if the user
specifies --privileged.

We also might want to turn off certain user namespace flags that will cause
buildah and podman build to work slower when creating container images.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-11-19 19:14:21 -05:00
Giuseppe Scrivano 06cea37b86
tests: add test for shifting support
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-07-27 17:24:19 +02:00
Daniel J Walsh 1075a73cac
Modify storage to allow callers to determine if a mount point is mounted
Add force to umount to force the umount of a container image
Add an interface to indicate whether or not the layer is mounted
Add a boolean return from unmount to indicate when the layer is really unmounted

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-07-17 14:00:15 -04:00
Giuseppe Scrivano 13af8ce953
tests: add test for ostree deduplication
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-06-29 18:47:10 +02:00
Giuseppe Scrivano d33931a3ec
tests: set mtime to the epoch
so it won't be different once added to OSTree.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-06-29 18:47:10 +02:00
Nalin Dahyabhai 24cee91c8a Add some tests for mapping using images
Add tests to exercise both handling mapping at the per-container level,
and at the in-image-layer level.  While having the image manage top
layers is preferable because it's faster for cases where multiple
containers which use the same ID mappings are being created from a
single image, for read-only image stores, that's not an option, so we
need to still be capable of doing things in the container's layer.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2018-05-30 17:16:53 -04:00
Nalin Dahyabhai b22d9f20d3 Exercise Copy[File]WithTar, optionally with Chown flags
Add integration tests to exercise CopyFileWithTar and CopyWithTar, both
with and without Chown flags.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2018-05-01 10:27:34 -04:00
Nalin Dahyabhai aefafeeb85 Add LayerParentOwners()/ContainerParentOwners()
Add store methods for finding the list of UIDs and GIDs which probably
need to be mapped if a given layer or container's layer, which has to
have been mounted at least once in order for us to know where it goes,
is going to be used for a container that is run with the configured ID
mappings in a separate user namespace.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2018-04-03 10:34:32 -04:00
Nalin Dahyabhai d76ed8aa9b Add ID-mapping tests
Add tests that exercise the ID mapping, diff applying, and diff
generating code against layers which are created with assorted ID
mapping options, and verify that layer contents also follow the expected
rules when we create containers.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2018-04-03 10:34:32 -04:00
Nalin Dahyabhai b5815b50bc Make sure $TMPDIR is set in test_drivers.bash
We don't use this yet, but we should start at some point, now that
overlay can pass it.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2018-02-23 16:00:48 -05:00
Nalin Dahyabhai 85e7fb392e Expand tests for layer changes/diffs
Make sure that tests for changes and diff generation include creating
subdirectories of directories that are inherited from a parent layer.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2018-02-23 16:00:48 -05:00
Nalin Dahyabhai 1824cf917a Add explicitly-settable digest values for images
Add explicitly-settable digest values for images that are treated mostly
like the implicit digests that we track for manifests, for the sake of
v1 images which have manifests that need to be preprocessed before being
digested to produce an image's digest value.  We'll still have the
digest of the unprocessed manifest, but that shouldn't hurt.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-12-11 16:16:46 -05:00
Nalin Dahyabhai 2a564455fd Add a notion of image "digests" based on their "manifest" data
Add a "digest" of an image that is equal to the digest of its big data
item named "manifest", if it has one, that we can index and use for
locating images.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-11-16 11:52:25 -05:00
Nalin Dahyabhai a634a805f8 Fixups for read-only store tests
* After we're done initializing a read-only store for a test, shut it
  down so that we'll be able to delete it when cleaning up later.
* When mounting a layer that inherits from read-only layers, don't
  forget to pass the read-only store's location to the CLI helper.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-10-18 13:01:07 -04:00
Nalin Dahyabhai 67739055a0 Add some integration tests
Try to exercise the CLI wrapper as much as we can.  It's not exhaustive,
but it's a start.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-10-04 15:14:57 -04:00
Nalin Dahyabhai 8c6a9fce16 Support additional image stores in "vfs"
Teach the vfs driver to use a list of search directories when looking
for a layer's directory, and have it interpret a "vfs.imagestore" option
to populate that list.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-10-03 12:46:49 -04:00
Nalin Dahyabhai 2036680a3a Finish renaming oci-storage to containers-storage
Update the rest of the documentation, scripts, and output.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-07-10 16:11:09 -04:00
Nalin Dahyabhai 230b9ab91a Replace the build system
Replace the bundle-targeted build system with simpler Makefile targets
and fewer helper scripts.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-05-25 15:50:33 -04:00