Commit Graph

91 Commits

Author SHA1 Message Date
Miloslav Trmač
cd71084908 Refer to registry.k8s.io instead of k8s.gcr.io
... per https://kubernetes.io/blog/2023/02/06/k8s-gcr-io-freeze-announcement/ .

We are seeing intermittent failures (sufficient to reliably cause a test suite failure)
pulling from k8s.gcr.io, let's see if using the newer one improves things.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2024-06-17 20:02:15 +02:00
Miloslav Trmač
513a4f1ab3 Update for changed c/image error texts
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2024-05-14 00:27:18 +02:00
Miloslav Trmač
9821af6f11 Freeze the fedora-minimal image reference at Fedora 38
... because the tests are assuming a v2s2 image, but
as of Fedora 39, the image uses the OCI format.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2024-04-03 18:13:23 +02:00
Miloslav Trmač
812a02af41 Replace decompress-dirs.sh with Go code
We will need to make it more sophisticated than
it is practical to do in Go.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2024-02-08 00:16:06 +01:00
Miloslav Trmač
4beb3f0af9 Fix some warnings
golangci-lint linter: unparam

This primarily fixes TestProxy to test the correct image

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2023-02-23 16:08:45 +01:00
Miloslav Trmač
2ef9cf6902 Replace gopkg.in/check.v1 by github.com/stretchr/testify/suite/
gopkg.in/check.v1 hasn't had any commit since Nov 2020.
That's not a immediate issue for a test-only dependency, but
because it hides access to the standard library *testing.T,
eventually it will become limiting.

Also, using the same framework for unit and integration tests
seems practical.

This is mostly a batch copy&paste job, with a fairly high risk
of unexpected breakage.

Also, I didn't take much time at all to carefully choose between
assert.* and require.*; we can tune that as failures show up.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2023-02-17 02:35:51 +01:00
Miloslav Trmač
2a7b132790 Simplify a condition
golangci-lint linter: ifshort

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2023-02-03 17:49:01 +01:00
Miloslav Trmač
9137ac5697 Simplify an increment
golangci-lint linter: gocritic

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2023-02-03 17:48:16 +01:00
Miloslav Trmač
891ba3d4a6 s/interface{}/any/g
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2023-02-02 22:27:35 +01:00
Miloslav Trmač
955a59c864 Update tests for changed error texts
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-10-12 22:56:46 +02:00
Miloslav Trmač
f3aee25c7c Fold a long line.
Should not change (test) behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-10-12 22:10:01 +02:00
Miloslav Trmač
b000ada3f3 Update for the renames of sigstore to lookaside
I left systemtest unmodified, to have _something_ that
exercises the compatibility path.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-07-12 13:47:35 +02:00
Miloslav Trmač
d9d3ceca45 Use filepath.WalkDir instead of filepath.Walk
... to optimize away some lstat(2) calls.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-04-13 20:14:04 +02:00
Miloslav Trmač
4811c07d71 Update users of deprecated io/ioutil
Mostly just name changes that should not change behavior, apart
from ioutil.ReadDir -> os.ReadDir avoiding per-item lstat(2) in
one case.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-04-13 20:13:52 +02:00
James Hewitt
4ef35a385a
Add option to specify the identity for signing
This enables pushing to registries where the push and pull uris may be
different, for example where pushed images are mirrored to a read only
replica for distribution.

Closes #1588

Signed-off-by: James Hewitt <james.hewitt@uk.ibm.com>
2022-03-30 22:02:43 +01:00
Miloslav Trmač
2019b79c7f Use check.C.MkDir() instead of manual ioutil.TempDir() calls
This saves us at least 2 lines (error check, and cleanup) on every
instance, or in some cases adds cleanup that we forgot.

This is inspired by, but not directly related to, Go 1.15's addition of
Testing.T.TempDir.

NOTE: This might significantly increase the tests' disk space requirements;
AFAICS the temporary directories are only cleaned up when a whole "suite
finishes running.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-03-16 16:05:08 +01:00
Miloslav Trmač
693de29e37 Add various missing error handling
... as found by (golangci-lint run).

Note: this does not add (golangci-lint run) to the Makefile
to ensure the coding standard.

(BTW golangci-lint currently fails on structcheck, which doesn't
handle embedded structs, and that's a years-long known unfixed
limitation.)

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-03-15 21:48:51 +01:00
Miloslav Trmač
23183072fb Work around systemd-resolved's handling of .invalid domains
... per https://github.com/containers/skopeo/pull/1558 .

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-02-15 16:54:51 +01:00
Miloslav Trmač
3be97ce281 Beautify a few calls
Use the sort-of-convention of keeping the output matching regex,
and the command, on separatel lines.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-02-15 16:54:51 +01:00
James Hewitt
2046bfdaaa Add option to preserve digests on copy
When enabled, if digests can't be preserved an error will be raised.

Signed-off-by: James Hewitt <james.hewitt@uk.ibm.com>
2021-12-07 13:16:10 +00:00
James Hewitt
d94015466f Add an option to allow copying image indexes alone
The new --multi-arch option allows the user to select between copying the
image associated with the system platform, all images in the index, or
just the index itself without attempting to copy the images.

Signed-off-by: James Hewitt <james.hewitt@uk.ibm.com>
2021-11-27 15:38:42 +00:00
James Hewitt
4dcd28df92 Use a dynamic temp dir for test
This test was incorrectly assuming that nothing would be made on disk,
but it was putting files into the source directory.

Signed-off-by: James Hewitt <james.hewitt@uk.ibm.com>
2021-11-27 13:44:28 +00:00
Miloslav Trmač
c399909f04 Update non-module dependencies
Dependabot was apparently not picking these up (and
several haven't had a release for a long time anyway).

Also move from github.com/go-check/check to its newly
declared (and go.mod-enforced) name gopkg.in/check.v1.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-08-23 15:52:48 +02:00
Miloslav Trmač
a1f9318e7b Fix two instances of unused err found by go-staticcheck
*cough* Go is an easy-to-use, hard-to-misuse language *cough*

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-07-28 21:46:07 +02:00
Chris Evich
285a5cb6a0
Fix using images from rate-limited docker hub
The necessary images have been manually copied over to quay.  Code was
updated with centralized constants for the utilized images.  Tests then
all reference the constants (in case the image locations need to change
again).

Signed-off-by: Chris Evich <cevich@redhat.com>
2021-07-22 16:28:20 -04:00
Miloslav Trmač
f80bf8a39f Revert "integration tests: disable ls for logs"
This reverts commit 65c5b0bf8d.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-07-09 13:15:13 +02:00
Daniel J Walsh
6d6c8b5609 Update tests for removal of error and Error from error messages
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-07-01 21:02:13 +02:00
Daniel J Walsh
b10d3e43a4
Merge pull request #1266 from cgwalters/copy-print-digest
copy: Add --digestfile
2021-05-07 05:17:35 -04:00
Colin Walters
a32be320cb copy: Add --digestfile
`podman push` gained this a while ago, and we want it here for the
same reason.

Motivated by closing a race condition in ostree-rs-ext:
17a991050c/lib/src/container/export.rs (L85)

Co-authored-by: Miloslav Trmač <mitr@redhat.com>
2021-05-06 09:19:16 -04:00
Brendan Aye
7898ffaf23
Added format parameter to sync command
Signed-off-by: Brendan Aye <brendan.aye@t-mobile.com>
2021-04-28 10:54:21 -07:00
Lokesh Mandvekar
b7bf15bc8b Dockerfile.build: switch to fedora:latest
CopySuite.TestCopySignatures: Use quay.io instead of docker.io.

Resolves: gh#174

Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
2021-02-24 15:49:14 +01:00
Miloslav Trmač
3c33cb4556 Add a smoke test for signedIdentity:remapIdentity
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-01-08 17:20:09 +01:00
Miloslav Trmač
f94d85aa8e Split copyWithSignedIdentity from TestCopyVerifyingMirroredSignatures
... because we will add another user.

Also remove an obsolete FIXME.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-01-08 17:20:09 +01:00
Nalin Dahyabhai
b3a15e7288 integration test: use fedora-minimal for most manifest list tests
Switch most of our tests that exercise reading, copying from, and
inspecting tags that point to manifest lists from using
docker.io/estesp/busybox to using
registry.fedoraproject.org/fedora-minimal, which doesn't limit how often
we can pull the images.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2021-01-08 09:50:12 -05:00
Josh Soref
4987a67293 Spelling
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2020-12-21 16:10:45 -05:00
Valentin Rothberg
65c5b0bf8d integration tests: disable ls for logs
For yet unknown reasons, Travis throws permission errors when trying to
recursively list the contents of a temp directory.  It passes locally,
so disable the logs to unblock CI.  Note, the reasons for the error are
yet to be revealed.

Related-issue: https://github.com/containers/skopeo/issues/1093
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-11-04 16:52:54 +01:00
Daniel J Walsh
62bafb102d
Fix problems found by codespell
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-09-11 10:19:16 -04:00
Miloslav Trmač
a6ab2291ba Add tests for using signatures with mirrors
... to test the fix for https://github.com/containers/image/pull/912 .

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2020-05-11 14:37:43 +02:00
Miloslav Trmač
02407d98a5 Fix TestCopyAtomicExtension
Actually test that X-R-S-S signatures are usable using atomic:,
as the comment says.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2020-05-01 01:27:03 +02:00
Valentin Rothberg
ed883c5230
Merge branch 'master' into feat-override-variant 2020-03-20 15:43:39 +01:00
Harshal Patil
8d1a4649f2 Partial image encryption support
Signed-off-by: Harshal Patil <harshal.patil@in.ibm.com>
2020-02-20 07:53:26 +05:30
Jirka Chadima
222beaf4c7
Adds the --override-variant command line flag
Signed-off-by: Jirka Chadima <chadima.jiri@gmail.com>
2020-01-09 15:13:28 +01:00
Harshal Patil
39ff039b3b Image encryption/decryption support in skopeo
Signed-off-by: Harshal Patil <harshal.patil@in.ibm.com>
Signed-off-by: Brandon Lum <lumjjb@gmail.com>
2019-11-26 15:17:38 +05:30
Miloslav Trmač
af0734832b Use a Windows Nano Server image instead of Server Core for multi-arch testing
This image is about 100 MB instead of about 2 GB for the Server Core,
decreasing disk requirements and hopefully significantly speeeding up
integration tests.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2019-11-21 21:25:35 +01:00
Valentin Rothberg
8f24d28130 vendor containers/image v5.0.0
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-10-28 10:37:46 +01:00
Nalin Dahyabhai
7d251f5a74 copy: add a --all/-a flag
Add a --all/-a flag to instruct us to attempt to copy all of the
instances in the source image, if the source image specified to "skopeo
copy" is actually a list of images.  Previously, we'd just try to locate
one for our preferred OS/arch combination.

Add a couple of tests to verify that we can copy an image into and then
back out of containers-storage.  The contents of an image that has been
copied out of containers-storage need a bit of tweaking to compensate
for containers-storage's habit of returning uncompressed versions of the
layer blobs that were originally written to it, in order to be
comparable to the image as it was when it was pulled from a registry.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2019-10-22 11:05:42 -04:00
Valentin Rothberg
7922028d7c Update to c/image v4.0.1
Update to use the correct c/image/v4 import path, work originally from
https://github.com/containers/skopeo/pull/733 by Valentin Rothberg <rothberg@redhat.com>.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2019-10-03 23:50:42 +02:00
Miloslav Trmač
23c6b42b26 Explicitly disable encrypting test GPG keys
Since GPG 2.1, GPG asks for a passphrase by default; opt out when
generating test keys to avoid
> gpg: agent_genkey failed: No pinentry
> gpg: key generation failed: No pinentry
which happens otherwise (and we can't use an interactive pinentry
in a batch process anyway).

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2019-06-10 22:03:23 +02:00
Tristan Cacqueray
8fb4ab3d92 Add integration test for invalid reference
This change adds a couple of tests to prevent further regression
introduced by https://github.com/containers/skopeo/pull/653

Signed-off-by: Tristan Cacqueray <tdecacqu@redhat.com>
2019-05-19 03:02:19 +00:00
Sascha Grunert
6b5bdb7563
Add skopeo registry mirror integration tests
- Update toml to latest release
- Update containers/image
- Add integration tests
- Add hidden `--registry-conf` flag used by the integration tests

Signed-off-by: Sascha Grunert <sgrunert@suse.com>
2019-04-25 11:35:12 +02:00