Documentation
¶
Overview ¶
Package rpmtest provides helpers for working with RPM packages in claircore tests.
Index ¶
- Variables
- func HintCompare(t testing.TB, repos []string) cmp.Option
- func Options(t testing.TB, repos []string) cmp.Options
- func PackagesFromManifest(t *testing.T, items iter.Seq[catalog.RpmsItems]) iter.Seq[claircore.Package]
- func PackagesFromRPMManifest(t *testing.T, r io.Reader) []*claircore.Package
- func VersionTransform(t testing.TB) cmp.Option
- type Archive
- func (a *Archive) Image(registry, repo string) (catalog.Images, error)
- func (a *Archive) Images() iter.Seq2[catalog.Image, error]
- func (a *Archive) Manifest(id string) (catalog.RpmManifest, error)
- func (a *Archive) Manifests() iter.Seq2[catalog.RpmManifest, error]
- func (a *Archive) Repositories() []string
- func (a *Archive) Repository() (catalog.Repository, error)
- func (a *Archive) Tests(ctx context.Context, ca *test.CachedArena, repoAllow map[string][]string, ...) func(*testing.T)
- func (a *Archive) URLs(_ context.Context) []string
- type Manifest
- type ManifestRPM
Constants ¶
This section is empty.
Variables ¶
var ( SortPackages = cmpopts.SortSlices(func(a, b *claircore.Package) bool { return a.Name < b.Name }) IgnoreFields = cmpopts.IgnoreFields(claircore.Package{}, ".PackageDB") )
Does what it says on the tin.
var ModuleCompare = cmp.FilterPath( func(p cmp.Path) bool { return p.Last().String() == ".Module" }, cmp.FilterValues( func(a, b string) bool { return a != "" && b == "" || a == "" && b != "" }, cmp.Ignore(), ), )
ModuleCompare allows one of the reported modules to be the empty string. This is needed because of KONFLUX-7481 (née STONEBLD-1472).
Functions ¶
func HintCompare ¶
HintCompare normalizes the claircore-internal "hint".
The RPM manifest doesn't have checksum information. It does have keyid information, so normalize down to the common set.
func Options ¶
Options is a standard set of cmp.Options for working with packages from rpm. The passed testing.TB is captured, so the returned Options cannot be reused across tests.
func PackagesFromManifest ¶ added in v1.5.38
func PackagesFromManifest(t *testing.T, items iter.Seq[catalog.RpmsItems]) iter.Seq[claircore.Package]
PackagesFromManifest transforms a sequence of catalog.RpmsItems into a sequence of claircore.Package.
func PackagesFromRPMManifest ¶
PackagesFromRPMManifest loads the rpm manifest in "r" and returns the contents as transformed into [claircore.Package]s.
func VersionTransform ¶ added in v1.5.38
VersionTransform turns a [Package.Version] into rpmver.Version. Go-cmp produces sensible output on rpmver.Version objects.
Types ¶
type Archive ¶ added in v1.5.38
type Archive struct {
// contains filtered or unexported fields
}
Archive is a helper for reading the txtar archives as produced by the test/cmd/fetch-container-rpm-manifest tool.
func OpenArchive ¶ added in v1.5.38
OpenArchive opens the manifest txtar at path "p".
func (*Archive) Images ¶ added in v1.5.38
Images reports the image descriptions recorded in the archive.
func (*Archive) Manifest ¶ added in v1.5.38
func (a *Archive) Manifest(id string) (catalog.RpmManifest, error)
func (*Archive) Manifests ¶ added in v1.5.38
Manifests reports the rpm manifests recorded in the archive.
func (*Archive) Repositories ¶ added in v1.5.38
Repositories reports the container image repositories in the archive.
func (*Archive) Repository ¶ added in v1.5.38
func (a *Archive) Repository() (catalog.Repository, error)
Repository reports the container image repository recorded in the archive.
func (*Archive) Tests ¶ added in v1.5.40
func (a *Archive) Tests( ctx context.Context, ca *test.CachedArena, repoAllow map[string][]string, tf func(context.Context, *claircore.Layer) ([]*claircore.Package, error), ) func(*testing.T)
Tests runs "tf" on images described in the archive and checks the output with the relevant rpm manifest in the archive.
type ManifestRPM ¶
ManifestRPM is a single RPM as described in the Red Hat Catalog rpm manifest.