Commit Graph

9 Commits

Author SHA1 Message Date
Miloslav Trmač a56436cb15 Use testing.T.Setenv instead of os.Setenv in tests
... to simplify and benefit from Go 1.17.

In some cases, wrap tests in testing.T.Run() to decrease
the scope, or to make the relationship between the test and the
cleanup clearer.  In some cases it's still a bit awkward
because there is no testing.T.Unsetenv, but still worth it.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-06-14 20:57:04 +02:00
Miloslav Trmač 9a9904944d Use testing.T.TempDir()
... to simplify tests.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-03-17 20:35:00 +01:00
Tycho Andersen f5547d5015 blobinfocache: clean up after test
Signed-off-by: Tycho Andersen <tycho@tycho.ws>
2020-06-24 08:10:39 -06:00
Ivan Voronchihin 33ec055725 Fix Error return value is not checked
Signed-off-by: Ivan Voronchihin <bege13mot@gmail.com>
2019-11-26 19:11:22 +04:00
Ivan Voronchihin 21320ca776 Fix golangci-lint advises
Signed-off-by: Ivan Voronchihin <bege13mot@gmail.com>
2019-11-26 18:31:04 +04:00
Miloslav Trmač 7d9cde7252 Update to major version v5
> gomove github.com/containers/image/v4 github.com/containers/image/v5
+ a manual edit of go.mod

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2019-10-25 22:27:45 +02:00
Miloslav Trmač e568c94ef3 Correctly use a c/image/v4 module namespace
... so that major-version-aware Go module import
(as opposed to vX.Y.Z+incompatible, which does not allow different
packages to use different versions) works right.

Also requires adding some more GO111MODULE=on options to Makefile.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2019-10-03 22:54:27 +02:00
W. Trevor King d545a196c9 pkg/blobinfocache: Split implementations into subpackages
This allows consumers who don't need the defaulting logic to pick
their desired implementation without pulling in unrelated
dependencies.  For example, it allows you to consume the memory or
NoCache implementations without pulling in github.com/boltdb.

I'd initially included blobinfocache wrappers to preserve backwards
compatibility with the old API while consumers updated to the new
APIs, but Miloslav said we don't have any backwards-compatibility
commitments at the moment [1].

Having single-implementation subpackages also allows for more generic
names (e.g. NewMemoryCache is now just New), because memory.New is
clear enough while memory.NewMemoryCache stutters.

[1]: https://github.com/containers/image/pull/602#issuecomment-471570789

Signed-off-by: W. Trevor King <wking@tremily.us>
2019-03-12 13:24:14 -07:00
Miloslav Trmač 03f6e49dc4 Add pkg/blobinfocache.DefaultCache()
This returns a default BoltDB instance (which almost everyone
should use to maximally benefit from the cache).  The default location
is chosen to exist near the containers/storage GraphRoot (i.e.
typically on the same partition, with the same SELinux context),
both for root and rootless modes of podman.

This adds no users yet, so should not immediately change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2018-12-06 18:59:24 +01:00