mocks

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CveInfoMock added in v1.4.3

type CveInfoMock struct {
	GetImageListForCVEFn       func(repo, cveID string) ([]cveinfo.ImageInfoByCVE, error)
	GetImageListWithCVEFixedFn func(repo, cveID string) ([]common.TagInfo, error)
	GetCVEListForImageFn       func(image string) (map[string]cvemodel.CVE, error)
	GetCVESummaryForImageFn    func(image string) (cveinfo.ImageCVESummary, error)
	UpdateDBFn                 func() error
}

func (CveInfoMock) GetCVEListForImage added in v1.4.3

func (cveInfo CveInfoMock) GetCVEListForImage(image string) (map[string]cvemodel.CVE, error)

func (CveInfoMock) GetCVESummaryForImage added in v1.4.3

func (cveInfo CveInfoMock) GetCVESummaryForImage(image string) (cveinfo.ImageCVESummary, error)

func (CveInfoMock) GetImageListForCVE added in v1.4.3

func (cveInfo CveInfoMock) GetImageListForCVE(repo, cveID string) ([]cveinfo.ImageInfoByCVE, error)

func (CveInfoMock) GetImageListWithCVEFixed added in v1.4.3

func (cveInfo CveInfoMock) GetImageListWithCVEFixed(repo, cveID string) ([]common.TagInfo, error)

func (CveInfoMock) UpdateDB added in v1.4.3

func (cveInfo CveInfoMock) UpdateDB() error

type CveScannerMock added in v1.4.3

type CveScannerMock struct {
	IsImageFormatScannableFn func(image string) (bool, error)
	ScanImageFn              func(image string) (map[string]cvemodel.CVE, error)
	CompareSeveritiesFn      func(severity1, severity2 string) int
	UpdateDBFn               func() error
}

func (CveScannerMock) CompareSeverities added in v1.4.3

func (scanner CveScannerMock) CompareSeverities(severity1, severity2 string) int

func (CveScannerMock) IsImageFormatScannable added in v1.4.3

func (scanner CveScannerMock) IsImageFormatScannable(image string) (bool, error)

func (CveScannerMock) ScanImage added in v1.4.3

func (scanner CveScannerMock) ScanImage(image string) (map[string]cvemodel.CVE, error)

func (CveScannerMock) UpdateDB added in v1.4.3

func (scanner CveScannerMock) UpdateDB() error

type FileInfoMock

type FileInfoMock struct {
	IsDirFn func() bool
	SizeFn  func() int64
}

func (*FileInfoMock) IsDir

func (f *FileInfoMock) IsDir() bool

func (*FileInfoMock) ModTime

func (f *FileInfoMock) ModTime() time.Time

func (*FileInfoMock) Path

func (f *FileInfoMock) Path() string

func (*FileInfoMock) Size

func (f *FileInfoMock) Size() int64

type FileWriterMock

type FileWriterMock struct {
	WriteFn  func([]byte) (int, error)
	CancelFn func() error
	CommitFn func() error
	CloseFn  func() error
}

func (*FileWriterMock) Cancel

func (f *FileWriterMock) Cancel() error

func (*FileWriterMock) Close

func (f *FileWriterMock) Close() error

func (*FileWriterMock) Commit

func (f *FileWriterMock) Commit() error

func (*FileWriterMock) Size

func (f *FileWriterMock) Size() int64

func (*FileWriterMock) Write

func (f *FileWriterMock) Write(p []byte) (int, error)

type MockedImageStore

type MockedImageStore struct {
	DirExistsFn            func(d string) bool
	RootDirFn              func() string
	InitRepoFn             func(name string) error
	ValidateRepoFn         func(name string) (bool, error)
	GetRepositoriesFn      func() ([]string, error)
	GetNextRepositoryFn    func(repo string) (string, error)
	GetImageTagsFn         func(repo string) ([]string, error)
	GetImageManifestFn     func(repo string, reference string) ([]byte, godigest.Digest, string, error)
	PutImageManifestFn     func(repo string, reference string, mediaType string, body []byte) (godigest.Digest, error)
	DeleteImageManifestFn  func(repo string, reference string, detectCollision bool) error
	BlobUploadPathFn       func(repo string, uuid string) string
	NewBlobUploadFn        func(repo string) (string, error)
	GetBlobUploadFn        func(repo string, uuid string) (int64, error)
	BlobUploadInfoFn       func(repo string, uuid string) (int64, error)
	PutBlobChunkStreamedFn func(repo string, uuid string, body io.Reader) (int64, error)
	PutBlobChunkFn         func(repo string, uuid string, from int64, to int64, body io.Reader) (int64, error)
	FinishBlobUploadFn     func(repo string, uuid string, body io.Reader, digest godigest.Digest) error
	FullBlobUploadFn       func(repo string, body io.Reader, digest godigest.Digest) (string, int64, error)
	DedupeBlobFn           func(src string, dstDigest godigest.Digest, dst string) error
	DeleteBlobUploadFn     func(repo string, uuid string) error
	BlobPathFn             func(repo string, digest godigest.Digest) string
	CheckBlobFn            func(repo string, digest godigest.Digest) (bool, int64, error)
	GetBlobPartialFn       func(repo string, digest godigest.Digest, mediaType string, from, to int64,
	) (io.ReadCloser, int64, int64, error)
	GetBlobFn           func(repo string, digest godigest.Digest, mediaType string) (io.ReadCloser, int64, error)
	DeleteBlobFn        func(repo string, digest godigest.Digest) error
	GetIndexContentFn   func(repo string) ([]byte, error)
	GetBlobContentFn    func(repo string, digest godigest.Digest) ([]byte, error)
	GetReferrersFn      func(repo string, digest godigest.Digest, artifactType string) (ispec.Index, error)
	GetOrasReferrersFn  func(repo string, digest godigest.Digest, artifactType string) ([]artifactspec.Descriptor, error)
	URLForPathFn        func(path string) (string, error)
	RunGCRepoFn         func(repo string) error
	RunGCPeriodicallyFn func(interval time.Duration, sch *scheduler.Scheduler)
}

func (MockedImageStore) BlobPath

func (is MockedImageStore) BlobPath(repo string, digest godigest.Digest) string

func (MockedImageStore) BlobUploadInfo

func (is MockedImageStore) BlobUploadInfo(repo string, uuid string) (int64, error)

func (MockedImageStore) BlobUploadPath

func (is MockedImageStore) BlobUploadPath(repo string, uuid string) string

func (MockedImageStore) CheckBlob

func (is MockedImageStore) CheckBlob(repo string, digest godigest.Digest) (bool, int64, error)

func (MockedImageStore) DedupeBlob

func (is MockedImageStore) DedupeBlob(src string, dstDigest godigest.Digest, dst string) error

func (MockedImageStore) DeleteBlob

func (is MockedImageStore) DeleteBlob(repo string, digest godigest.Digest) error

func (MockedImageStore) DeleteBlobUpload

func (is MockedImageStore) DeleteBlobUpload(repo string, uuid string) error

func (MockedImageStore) DeleteImageManifest

func (is MockedImageStore) DeleteImageManifest(name string, reference string, detectCollision bool) error

func (MockedImageStore) DirExists

func (is MockedImageStore) DirExists(d string) bool

func (MockedImageStore) FinishBlobUpload

func (is MockedImageStore) FinishBlobUpload(repo string, uuid string, body io.Reader, digest godigest.Digest) error

func (MockedImageStore) FullBlobUpload

func (is MockedImageStore) FullBlobUpload(repo string, body io.Reader, digest godigest.Digest) (string, int64, error)

func (MockedImageStore) GetBlob

func (is MockedImageStore) GetBlob(repo string, digest godigest.Digest, mediaType string,
) (io.ReadCloser, int64, error)

func (MockedImageStore) GetBlobContent

func (is MockedImageStore) GetBlobContent(repo string, digest godigest.Digest) ([]byte, error)

func (MockedImageStore) GetBlobPartial

func (is MockedImageStore) GetBlobPartial(repo string, digest godigest.Digest, mediaType string, from, to int64,
) (io.ReadCloser, int64, int64, error)

func (MockedImageStore) GetBlobUpload

func (is MockedImageStore) GetBlobUpload(repo string, uuid string) (int64, error)

func (MockedImageStore) GetImageManifest

func (is MockedImageStore) GetImageManifest(repo string, reference string) ([]byte, godigest.Digest, string, error)

func (MockedImageStore) GetImageTags

func (is MockedImageStore) GetImageTags(name string) ([]string, error)

func (MockedImageStore) GetIndexContent

func (is MockedImageStore) GetIndexContent(repo string) ([]byte, error)

func (MockedImageStore) GetNextRepository added in v1.4.3

func (is MockedImageStore) GetNextRepository(repo string) (string, error)

func (MockedImageStore) GetOrasReferrers added in v1.4.3

func (is MockedImageStore) GetOrasReferrers(
	repo string,
	digest godigest.Digest,
	artifactType string,
) ([]artifactspec.Descriptor, error)

func (MockedImageStore) GetReferrers

func (is MockedImageStore) GetReferrers(
	repo string, digest godigest.Digest,
	artifactType string,
) (ispec.Index, error)

func (MockedImageStore) GetRepositories

func (is MockedImageStore) GetRepositories() ([]string, error)

func (MockedImageStore) InitRepo

func (is MockedImageStore) InitRepo(name string) error

func (MockedImageStore) Lock

func (is MockedImageStore) Lock(t *time.Time)

func (MockedImageStore) NewBlobUpload

func (is MockedImageStore) NewBlobUpload(repo string) (string, error)

func (MockedImageStore) PutBlobChunk

func (is MockedImageStore) PutBlobChunk(
	repo string,
	uuid string,
	from int64,
	to int64,
	body io.Reader,
) (int64, error)

func (MockedImageStore) PutBlobChunkStreamed

func (is MockedImageStore) PutBlobChunkStreamed(repo string, uuid string, body io.Reader) (int64, error)

func (MockedImageStore) PutImageManifest

func (is MockedImageStore) PutImageManifest(
	repo string,
	reference string,
	mediaType string,
	body []byte,
) (godigest.Digest, error)

func (MockedImageStore) RLock

func (is MockedImageStore) RLock(t *time.Time)

func (MockedImageStore) RUnlock

func (is MockedImageStore) RUnlock(t *time.Time)

func (MockedImageStore) RootDir

func (is MockedImageStore) RootDir() string

func (MockedImageStore) RunGCPeriodically added in v1.4.3

func (is MockedImageStore) RunGCPeriodically(interval time.Duration, sch *scheduler.Scheduler)

func (MockedImageStore) RunGCRepo

func (is MockedImageStore) RunGCRepo(repo string) error

func (MockedImageStore) URLForPath

func (is MockedImageStore) URLForPath(path string) (string, error)

func (MockedImageStore) Unlock

func (is MockedImageStore) Unlock(t *time.Time)

func (MockedImageStore) ValidateRepo

func (is MockedImageStore) ValidateRepo(name string) (bool, error)

type MockedLint

type MockedLint struct {
	LintFn func(repo string, manifestDigest godigest.Digest, imageStore storage.ImageStore) (bool, error)
}

func (MockedLint) Lint

func (lint MockedLint) Lint(repo string, manifestDigest godigest.Digest, imageStore storage.ImageStore) (bool, error)

type OciLayoutUtilsMock

type OciLayoutUtilsMock struct {
	GetImageManifestFn          func(repo string, reference string) (ispec.Manifest, godigest.Digest, error)
	GetImageManifestsFn         func(repo string) ([]ispec.Descriptor, error)
	GetImageBlobManifestFn      func(repo string, digest godigest.Digest) (ispec.Manifest, error)
	GetImageInfoFn              func(repo string, digest godigest.Digest) (ispec.Image, error)
	GetImageTagsWithTimestampFn func(repo string) ([]common.TagInfo, error)
	GetImagePlatformFn          func(imageInfo ispec.Image) (string, string)
	GetImageVendorFn            func(imageInfo ispec.Image) string
	GetImageManifestSizeFn      func(repo string, manifestDigest godigest.Digest) int64
	GetImageConfigSizeFn        func(repo string, manifestDigest godigest.Digest) int64
	GetRepoLastUpdatedFn        func(repo string) (common.TagInfo, error)
	GetExpandedRepoInfoFn       func(name string) (common.RepoInfo, error)
	GetImageConfigInfoFn        func(repo string, manifestDigest godigest.Digest) (ispec.Image, error)
	CheckManifestSignatureFn    func(name string, digest godigest.Digest) bool
	GetRepositoriesFn           func() ([]string, error)
}

func (OciLayoutUtilsMock) CheckManifestSignature

func (olum OciLayoutUtilsMock) CheckManifestSignature(name string, digest godigest.Digest) bool

func (OciLayoutUtilsMock) GetExpandedRepoInfo

func (olum OciLayoutUtilsMock) GetExpandedRepoInfo(name string) (common.RepoInfo, error)

func (OciLayoutUtilsMock) GetImageBlobManifest

func (olum OciLayoutUtilsMock) GetImageBlobManifest(repo string, digest godigest.Digest) (ispec.Manifest, error)

func (OciLayoutUtilsMock) GetImageConfigInfo

func (olum OciLayoutUtilsMock) GetImageConfigInfo(repo string, manifestDigest godigest.Digest) (ispec.Image, error)

func (OciLayoutUtilsMock) GetImageConfigSize

func (olum OciLayoutUtilsMock) GetImageConfigSize(repo string, manifestDigest godigest.Digest) int64

func (OciLayoutUtilsMock) GetImageInfo

func (olum OciLayoutUtilsMock) GetImageInfo(repo string, digest godigest.Digest) (ispec.Image, error)

func (OciLayoutUtilsMock) GetImageManifest added in v1.4.3

func (olum OciLayoutUtilsMock) GetImageManifest(repo string, reference string,
) (ispec.Manifest, godigest.Digest, error)

func (OciLayoutUtilsMock) GetImageManifestSize

func (olum OciLayoutUtilsMock) GetImageManifestSize(repo string, manifestDigest godigest.Digest) int64

func (OciLayoutUtilsMock) GetImageManifests

func (olum OciLayoutUtilsMock) GetImageManifests(repo string) ([]ispec.Descriptor, error)

func (OciLayoutUtilsMock) GetImagePlatform

func (olum OciLayoutUtilsMock) GetImagePlatform(imageInfo ispec.Image) (string, string)

func (OciLayoutUtilsMock) GetImageTagsWithTimestamp

func (olum OciLayoutUtilsMock) GetImageTagsWithTimestamp(repo string) ([]common.TagInfo, error)

func (OciLayoutUtilsMock) GetImageVendor

func (olum OciLayoutUtilsMock) GetImageVendor(imageInfo ispec.Image) string

func (OciLayoutUtilsMock) GetRepoLastUpdated

func (olum OciLayoutUtilsMock) GetRepoLastUpdated(repo string) (common.TagInfo, error)

func (OciLayoutUtilsMock) GetRepositories added in v1.4.3

func (olum OciLayoutUtilsMock) GetRepositories() ([]string, error)

type StorageDriverMock

type StorageDriverMock struct {
	NameFn       func() string
	GetContentFn func(ctx context.Context, path string) ([]byte, error)
	PutContentFn func(ctx context.Context, path string, content []byte) error
	ReaderFn     func(ctx context.Context, path string, offset int64) (io.ReadCloser, error)
	WriterFn     func(ctx context.Context, path string, isAppend bool) (driver.FileWriter, error)
	StatFn       func(ctx context.Context, path string) (driver.FileInfo, error)
	ListFn       func(ctx context.Context, path string) ([]string, error)
	MoveFn       func(ctx context.Context, sourcePath, destPath string) error
	DeleteFn     func(ctx context.Context, path string) error
	WalkFn       func(ctx context.Context, path string, f driver.WalkFn) error
}

func (*StorageDriverMock) Delete

func (s *StorageDriverMock) Delete(ctx context.Context, path string) error

func (*StorageDriverMock) GetContent

func (s *StorageDriverMock) GetContent(ctx context.Context, path string) ([]byte, error)

func (*StorageDriverMock) List

func (s *StorageDriverMock) List(ctx context.Context, path string) ([]string, error)

func (*StorageDriverMock) Move

func (s *StorageDriverMock) Move(ctx context.Context, sourcePath, destPath string) error

func (*StorageDriverMock) Name

func (s *StorageDriverMock) Name() string

func (*StorageDriverMock) PutContent

func (s *StorageDriverMock) PutContent(ctx context.Context, path string, content []byte) error

func (*StorageDriverMock) Reader

func (s *StorageDriverMock) Reader(ctx context.Context, path string, offset int64) (io.ReadCloser, error)

func (*StorageDriverMock) Stat

func (*StorageDriverMock) URLFor

func (s *StorageDriverMock) URLFor(ctx context.Context, path string, options map[string]interface{}) (string, error)

func (*StorageDriverMock) Walk

func (s *StorageDriverMock) Walk(ctx context.Context, path string, f driver.WalkFn) error

func (*StorageDriverMock) Writer

func (s *StorageDriverMock) Writer(ctx context.Context, path string, isAppend bool) (driver.FileWriter, error)

Jump to

Keyboard shortcuts

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