mirror of
https://github.com/anchore/syft.git
synced 2026-11-03 07:56:36 +01:00
feat: add safe tensor model type to SBOM output (#4844)
--------- Signed-off-by: Christopher Phillips <32073428+spiffcs@users.noreply.github.com> Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> Co-authored-by: Alex Goodman <wagoodman@users.noreply.github.com>
This commit is contained in:
co-authored by
Alex Goodman
parent
ed499fd2d0
commit
aff2c247db
@@ -25,6 +25,7 @@ type MockResolver struct {
|
||||
mediaTypeIndex map[string][]Location
|
||||
extension map[string][]Location
|
||||
basename map[string][]Location
|
||||
ociRef string
|
||||
}
|
||||
|
||||
// NewMockResolverForPaths creates a new MockResolver, where the only resolvable
|
||||
@@ -74,6 +75,16 @@ func NewMockResolverForPathsWithMetadata(metadata map[Coordinates]Metadata) *Moc
|
||||
}
|
||||
}
|
||||
|
||||
// NewMockResolverForOCIArtifact creates a MockResolver that can resolve files
|
||||
// by media type AND surfaces the given OCI ref via the ImageReference method.
|
||||
// Intended for tests that exercise the catalogers' OCI-artifact-aware naming
|
||||
// code paths.
|
||||
func NewMockResolverForOCIArtifact(ref string, mediaTypes map[string][]Location) *MockResolver {
|
||||
r := NewMockResolverForMediaTypes(mediaTypes)
|
||||
r.ociRef = ref
|
||||
return r
|
||||
}
|
||||
|
||||
// NewMockResolverForMediaTypes creates a MockResolver that can resolve files by media type.
|
||||
// The mediaTypes map specifies which locations should be returned for each media type.
|
||||
func NewMockResolverForMediaTypes(mediaTypes map[string][]Location) *MockResolver {
|
||||
@@ -102,6 +113,11 @@ func NewMockResolverForMediaTypes(mediaTypes map[string][]Location) *MockResolve
|
||||
}
|
||||
}
|
||||
|
||||
// ImageReference returns the image reference associated with this mock, if any.
|
||||
func (r MockResolver) ImageReference() string {
|
||||
return r.ociRef
|
||||
}
|
||||
|
||||
// HasPath indicates if the given path exists in the underlying source.
|
||||
func (r MockResolver) HasPath(path string) bool {
|
||||
for _, l := range r.locations {
|
||||
|
||||
Reference in New Issue
Block a user