featurefmt

package
v0.0.0-...-41c8d9c Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package featurefmt exposes functions to dynamically register methods for determining the features present in an image layer.

Package featurefmt contains utility functions for featurefmt tests

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListFeatures

func ListFeatures(files tarutil.FilesMap, toUse []database.Detector) ([]database.LayerFeature, error)

ListFeatures produces the list of Features in an image layer using every registered Lister.

func ListListers

func ListListers() []database.Detector

ListListers returns the names of all the registered feature listers.

func LoadFileForTest

func LoadFileForTest(name string) []byte

LoadFileForTest can be used in order to obtain the []byte contents of a file that is meant to be used for test data.

func RegisterLister

func RegisterLister(name string, version string, l Lister)

RegisterLister makes a Lister available by the provided name.

If called twice with the same name, the name is blank, or if the provided Lister is nil, this function panics.

func RequiredFilenames

func RequiredFilenames(toUse []database.Detector) (files []string)

RequiredFilenames returns all file patterns that will be passed to the given extensions. These patterns are expressed as regexps. Any extension metadata that has non feature-detector type will be skipped.

func RunTest

func RunTest(t *testing.T, test TestCase, lister Lister, expectedVersionFormat string)

RunTest runs a featurefmt test by loading the package info database files and the expected packages.

Types

type Lister

type Lister interface {
	// ListFeatures produces a list of Features present in an image layer.
	ListFeatures(tarutil.FilesMap) ([]database.LayerFeature, error)

	// RequiredFilenames returns a list of patterns for filenames that will
	// be in the FilesMap provided to the ListFeatures method.
	//
	// The patterns are expressed as regexps, and will be matched against
	// full paths that do not include the leading "/".
	RequiredFilenames() []string
}

Lister represents an ability to list the features present in an image layer.

type TestCase

type TestCase struct {
	Name           string
	FilePaths      map[string]string
	ExpectedResult []database.LayerFeature
}

TestCase is used by the RunTest function to execute.

Directories

Path Synopsis
Package apk implements a featurefmt.Lister for APK packages.
Package apk implements a featurefmt.Lister for APK packages.
Package dpkg implements a featurefmt.Lister for dpkg packages.
Package dpkg implements a featurefmt.Lister for dpkg packages.
Package rpm implements a featurefmt.Lister for rpm packages.
Package rpm implements a featurefmt.Lister for rpm packages.

Jump to

Keyboard shortcuts

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