testutils

package
v0.89.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddSampleFileRelationships

func AddSampleFileRelationships(s *sbom.SBOM)

func AssertEncoderAgainstGoldenImageSnapshot

func AssertEncoderAgainstGoldenImageSnapshot(t *testing.T, imgCfg ImageSnapshotTestConfig, cfg EncoderSnapshotTestConfig)

func AssertEncoderAgainstGoldenSnapshot

func AssertEncoderAgainstGoldenSnapshot(t *testing.T, cfg EncoderSnapshotTestConfig)

func DirectoryInput

func DirectoryInput(t testing.TB, dir string) sbom.SBOM

func DirectoryInputWithAuthorField added in v0.79.0

func DirectoryInputWithAuthorField(t testing.TB) sbom.SBOM

func ImageInput

func ImageInput(t testing.TB, testImage string, options ...ImageOption) sbom.SBOM

Types

type EncoderSnapshotTestConfig added in v0.85.0

type EncoderSnapshotTestConfig struct {
	Subject                     sbom.SBOM
	Format                      sbom.Format
	UpdateSnapshot              bool
	PersistRedactionsInSnapshot bool
	IsJSON                      bool
	Redactor                    Redactor
}

type ImageOption

type ImageOption func(cfg *imageCfg)

func FromSnapshot

func FromSnapshot() ImageOption

type ImageSnapshotTestConfig added in v0.85.0

type ImageSnapshotTestConfig struct {
	Image               string
	UpdateImageSnapshot bool
}

type PatternReplacement added in v0.85.0

type PatternReplacement struct {
	Search  *regexp.Regexp
	Replace string
}

func NewPatternReplacement added in v0.85.0

func NewPatternReplacement(r *regexp.Regexp) PatternReplacement

func (PatternReplacement) Redact added in v0.85.0

func (p PatternReplacement) Redact(b []byte) []byte

type Redactions added in v0.85.0

type Redactions struct {
	// contains filtered or unexported fields
}

func NewRedactions added in v0.85.0

func NewRedactions(redactors ...Redactor) *Redactions

func (Redactions) Redact added in v0.85.0

func (r Redactions) Redact(b []byte) []byte

func (*Redactions) WithFunctions added in v0.85.0

func (r *Redactions) WithFunctions(values ...func([]byte) []byte) *Redactions

func (*Redactions) WithPatternRedactors added in v0.85.0

func (r *Redactions) WithPatternRedactors(values map[string]string) *Redactions

func (*Redactions) WithPatternsRedacted added in v0.85.0

func (r *Redactions) WithPatternsRedacted(values ...string) *Redactions

func (*Redactions) WithRedactors added in v0.85.0

func (r *Redactions) WithRedactors(rs ...Redactor) *Redactions

func (*Redactions) WithValueRedactors added in v0.85.0

func (r *Redactions) WithValueRedactors(values map[string]string) *Redactions

func (*Redactions) WithValuesRedacted added in v0.85.0

func (r *Redactions) WithValuesRedacted(values ...string) *Redactions

type Redactor added in v0.85.0

type Redactor interface {
	Redact([]byte) []byte
}

type RedactorFn added in v0.85.0

type RedactorFn func([]byte) []byte

func (RedactorFn) Redact added in v0.85.0

func (r RedactorFn) Redact(b []byte) []byte

type ValueReplacement added in v0.85.0

type ValueReplacement struct {
	Search  string
	Replace string
}

func NewValueReplacement added in v0.85.0

func NewValueReplacement(v string) ValueReplacement

func (ValueReplacement) Redact added in v0.85.0

func (v ValueReplacement) Redact(b []byte) []byte

Jump to

Keyboard shortcuts

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