rpmtest

package
v1.5.48 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2025 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

Package rpmtest provides helpers for working with RPM packages in claircore tests.

Index

Constants

This section is empty.

Variables

View Source
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.

View Source
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

func HintCompare(t testing.TB, repos []string) cmp.Option

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

func Options(t testing.TB, repos []string) cmp.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

func PackagesFromRPMManifest(t *testing.T, r io.Reader) []*claircore.Package

PackagesFromRPMManifest loads the rpm manifest in "r" and returns the contents as transformed into [claircore.Package]s.

func VersionTransform added in v1.5.38

func VersionTransform(t testing.TB) cmp.Option

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

func OpenArchive(_ context.Context, p string) (*Archive, error)

OpenArchive opens the manifest txtar at path "p".

func (*Archive) Image added in v1.5.38

func (a *Archive) Image(registry, repo string) (catalog.Images, error)

func (*Archive) Images added in v1.5.38

func (a *Archive) Images() iter.Seq2[catalog.Image, error]

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

func (a *Archive) Manifests() iter.Seq2[catalog.RpmManifest, error]

Manifests reports the rpm manifests recorded in the archive.

func (*Archive) Repositories added in v1.5.38

func (a *Archive) Repositories() []string

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.

func (*Archive) URLs added in v1.5.38

func (a *Archive) URLs(_ context.Context) []string

URLs reports the URLs that were used while creating the archive.

type Manifest

type Manifest = catalog.RpmManifest

Manifest is a Red Hat Catalog rpm manifest.

type ManifestRPM

type ManifestRPM = catalog.RpmsItems

ManifestRPM is a single RPM as described in the Red Hat Catalog rpm manifest.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL