Documentation
¶
Overview ¶
Package fakelayerbuilder uses a yaml file with custom syntax to build up fake layers for testing
Example:
```yml
layers:
# Add foo.txt lockfile
- files:
foo.txt:
# With the package foo
- foo
bar.txt:
- bar
# Delete the bar lockfile
- files:
!bar.txt:
- files:
baz.txt:
- baz
# Readd bar
- files:
bar.txt:
- bar
```
Index ¶
- func BuildFakeChainLayersFromPath(t *testing.T, testDir string, layerInfoPath string) []*fakechainlayer.FakeChainLayer
- type FakeTestLayers
- type FakeTestLayersExtractor
- func (e FakeTestLayersExtractor) Extract(_ context.Context, input *filesystem.ScanInput) (inventory.Inventory, error)
- func (e FakeTestLayersExtractor) FileRequired(_ filesystem.FileAPI) bool
- func (e FakeTestLayersExtractor) Name() string
- func (e FakeTestLayersExtractor) Requirements() *plugin.Capabilities
- func (e FakeTestLayersExtractor) Version() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildFakeChainLayersFromPath ¶
func BuildFakeChainLayersFromPath(t *testing.T, testDir string, layerInfoPath string) []*fakechainlayer.FakeChainLayer
BuildFakeChainLayersFromPath builds a slice of fake chain layers from a yaml file as defined at the top of this file.
Types ¶
type FakeTestLayers ¶
type FakeTestLayers struct {
Layers []struct {
Files map[string][]string `yaml:"files"`
} `yaml:"layers"`
}
FakeTestLayers structure is used to mock a fake image filesystem to test extraction against.
type FakeTestLayersExtractor ¶
type FakeTestLayersExtractor struct {
}
FakeTestLayersExtractor extracts FakeTestLayers built from the FakeLayerBuilder
func (FakeTestLayersExtractor) Extract ¶
func (e FakeTestLayersExtractor) Extract(_ context.Context, input *filesystem.ScanInput) (inventory.Inventory, error)
Extract extracts packages from yarn.lock files passed through the scan input.
func (FakeTestLayersExtractor) FileRequired ¶
func (e FakeTestLayersExtractor) FileRequired(_ filesystem.FileAPI) bool
FileRequired always returns true, as this is for testing only
func (FakeTestLayersExtractor) Name ¶
func (e FakeTestLayersExtractor) Name() string
Name of the extractor.
func (FakeTestLayersExtractor) Requirements ¶
func (e FakeTestLayersExtractor) Requirements() *plugin.Capabilities
Requirements of the extractor.
func (FakeTestLayersExtractor) Version ¶
func (e FakeTestLayersExtractor) Version() int
Version of the extractor.
Click to show internal directories.
Click to hide internal directories.