Documentation ¶
Index ¶
- Constants
- func AddImage(t *testing.T, fos *FakeOpenShift, image *imageapiv1.Image, ...)
- func AddImageStream(t *testing.T, fos *FakeOpenShift, namespace, name string, ...) *imageapiv1.ImageStream
- func AddImageStreamTag(t *testing.T, fos *FakeOpenShift, image *imageapiv1.Image, ...) *imageapiv1.ImageStreamTag
- func AddRandomImage(t *testing.T, fos *FakeOpenShift, namespace, name, tag string) *imageapiv1.Image
- func AddUntaggedImage(t *testing.T, fos *FakeOpenShift, image *imageapiv1.Image)
- func AssertManifestsEqual(t *testing.T, description string, ma distribution.Manifest, ...)
- func CanonicalManifest(m distribution.Manifest) ([]byte, error)
- func CreateAndUploadTestManifest(ctx context.Context, schemaVersion ManifestSchemaVersion, layerCount int, ...) (dgst digest.Digest, canonical, manifestConfig string, ...)
- func CreateRandomImage(namespace, name string) (*imageapiv1.Image, error)
- func CreateRandomTarFile() ([]byte, error)
- func MakeRandomLayer() ([]byte, distribution.Descriptor, error)
- func MakeSchema1Manifest(name, tag string, layers []distribution.Descriptor) (distribution.Manifest, error)
- func MakeSchema2Manifest(config distribution.Descriptor, layers []distribution.Descriptor) (distribution.Manifest, error)
- func NewBasicCredentialStore(username, password string) auth.CredentialStore
- func NewImageForManifest(repoName string, rawManifest string, manifestConfig string, ...) (*imageapiv1.Image, error)
- func NewRepository(ctx context.Context, repoName string, baseURL string, ...) (distribution.Repository, error)
- func NewTransport(baseURL string, repoName string, creds auth.CredentialStore) (http.RoundTripper, error)
- func UploadBlob(ctx context.Context, repo distribution.Repository, ...) error
- func UploadManifest(ctx context.Context, repo distribution.Repository, tag string, ...) error
- func UploadRandomTestBlob(ctx context.Context, baseURL string, creds auth.CredentialStore, ...) (distribution.Descriptor, []byte, error)
- func UploadSchema2Image(ctx context.Context, repo distribution.Repository, tag string) (distribution.Manifest, error)
- func WithTestLogger(parent context.Context, t *testing.T) context.Context
- type ConfigPayload
- type FakeOpenShift
- func (fos *FakeOpenShift) AddReactorsTo(c *imagefakeclient.FakeImageV1)
- func (fos *FakeOpenShift) CreateImage(image *imageapiv1.Image) (*imageapiv1.Image, error)
- func (fos *FakeOpenShift) CreateImageStream(namespace string, is *imageapiv1.ImageStream) (*imageapiv1.ImageStream, error)
- func (fos *FakeOpenShift) CreateImageStreamMapping(namespace string, ism *imageapiv1.ImageStreamMapping) (*imageapiv1.ImageStreamMapping, error)
- func (fos *FakeOpenShift) CreateImageStreamTag(namespace string, istag *imageapiv1.ImageStreamTag) (*imageapiv1.ImageStreamTag, error)
- func (fos *FakeOpenShift) GetImage(name string) (*imageapiv1.Image, error)
- func (fos *FakeOpenShift) GetImageStream(namespace, repo string) (*imageapiv1.ImageStream, error)
- func (fos *FakeOpenShift) GetImageStreamImage(namespace string, id string) (*imageapiv1.ImageStreamImage, error)
- func (fos *FakeOpenShift) UpdateImage(image *imageapiv1.Image) (*imageapiv1.Image, error)
- func (fos *FakeOpenShift) UpdateImageStream(namespace string, is *imageapiv1.ImageStream) (*imageapiv1.ImageStream, error)
- type ManifestSchemaVersion
Constants ¶
const SampleImageManifestSchema1 = `` /* 1130-byte string literal not displayed */
Variables ¶
This section is empty.
Functions ¶
func AddImage ¶
func AddImage(t *testing.T, fos *FakeOpenShift, image *imageapiv1.Image, namespace, name, tag string)
AddImage tags image into the image stream namespace/name.
func AddImageStream ¶
func AddImageStream(t *testing.T, fos *FakeOpenShift, namespace, name string, annotations map[string]string) *imageapiv1.ImageStream
AddImageStream creates a new image stream with annotations.
func AddImageStreamTag ¶
func AddImageStreamTag(t *testing.T, fos *FakeOpenShift, image *imageapiv1.Image, namespace, name string, tag *imageapiv1.TagReference) *imageapiv1.ImageStreamTag
AddImageStreamTag creates an image stream tag.
func AddRandomImage ¶
func AddRandomImage(t *testing.T, fos *FakeOpenShift, namespace, name, tag string) *imageapiv1.Image
AddRandomImage creates a new image with a random content and tags it into the image stream namespace/name. If the image stream doesn't exists, it will be created.
func AddUntaggedImage ¶
func AddUntaggedImage(t *testing.T, fos *FakeOpenShift, image *imageapiv1.Image)
AddUntaggedImage creates image in fos.
func AssertManifestsEqual ¶
func AssertManifestsEqual(t *testing.T, description string, ma distribution.Manifest, mb distribution.Manifest)
AssertManifestsEqual compares two manifests and returns if they are equal. Signatures of manifest schema 1 are not taken into account.
func CanonicalManifest ¶
func CanonicalManifest(m distribution.Manifest) ([]byte, error)
CanonicalManifest returns m in its canonical representation.
func CreateAndUploadTestManifest ¶
func CreateAndUploadTestManifest( ctx context.Context, schemaVersion ManifestSchemaVersion, layerCount int, serverURL *url.URL, creds auth.CredentialStore, repoName, tag string, ) (dgst digest.Digest, canonical, manifestConfig string, manifest distribution.Manifest, err error)
CreateAndUploadTestManifest generates a random manifest blob and uploads it to the given repository. For this purpose, a given number of layers will be created and uploaded.
func CreateRandomImage ¶
func CreateRandomImage(namespace, name string) (*imageapiv1.Image, error)
CreateRandomImage creates an image with a random content.
func CreateRandomTarFile ¶
CreateRandomTarFile creates a random tarfile and returns its content. An error is returned if there is a problem generating valid content. Inspired by github.com/docker/distribution/testutil/tarfile.go.
func MakeRandomLayer ¶
func MakeRandomLayer() ([]byte, distribution.Descriptor, error)
func MakeSchema1Manifest ¶
func MakeSchema1Manifest(name, tag string, layers []distribution.Descriptor) (distribution.Manifest, error)
MakeSchema1Manifest constructs a schema 1 manifest from a given list of digests and returns the digest of the manifest
func MakeSchema2Manifest ¶
func MakeSchema2Manifest(config distribution.Descriptor, layers []distribution.Descriptor) (distribution.Manifest, error)
MakeSchema2Manifest constructs a schema 2 manifest from a given list of digests and returns the digest of the manifest
func NewBasicCredentialStore ¶
func NewBasicCredentialStore(username, password string) auth.CredentialStore
NewBasicCredentialStore returns a test credential store for use with registry token handler and/or basic handler.
func NewImageForManifest ¶
func NewImageForManifest(repoName string, rawManifest string, manifestConfig string, managedByOpenShift bool) (*imageapiv1.Image, error)
NewImageForManifest creates a new Image object for the given manifest string. Note that the manifest must contain signatures if it is of schema 1.
func NewRepository ¶
func NewRepository(ctx context.Context, repoName string, baseURL string, transport http.RoundTripper) (distribution.Repository, error)
NewRepository creates a new Repository for the given repository name, base URL and creds.
func NewTransport ¶
func NewTransport(baseURL string, repoName string, creds auth.CredentialStore) (http.RoundTripper, error)
func UploadBlob ¶
func UploadBlob(ctx context.Context, repo distribution.Repository, desc distribution.Descriptor, content []byte) error
UploadBlob uploads the blob with content to repo and verifies its digest.
func UploadManifest ¶
func UploadManifest(ctx context.Context, repo distribution.Repository, tag string, manifest distribution.Manifest) error
UploadManifest uploads manifest to repo and verifies its digest.
func UploadRandomTestBlob ¶
func UploadRandomTestBlob(ctx context.Context, baseURL string, creds auth.CredentialStore, repoName string) (distribution.Descriptor, []byte, error)
UploadRandomTestBlob generates a random tar file and uploads it to the given repository.
func UploadSchema2Image ¶
func UploadSchema2Image(ctx context.Context, repo distribution.Repository, tag string) (distribution.Manifest, error)
UploadSchema2Image creates a random image with a schema 2 manifest and uploads it to the repository.
Types ¶
type ConfigPayload ¶
type ConfigPayload []byte
func MakeManifestConfig ¶
func MakeManifestConfig() (ConfigPayload, distribution.Descriptor, error)
type FakeOpenShift ¶
type FakeOpenShift struct {
// contains filtered or unexported fields
}
FakeOpenShift is an in-mempory reactors for fake.Client.
func NewFakeOpenShift ¶
func NewFakeOpenShift(ctx context.Context) *FakeOpenShift
NewFakeOpenShift constructs the fake OpenShift reactors.
func NewFakeOpenShiftWithClient ¶
func NewFakeOpenShiftWithClient(ctx context.Context) (*FakeOpenShift, *imagefakeclient.FakeImageV1)
NewFakeOpenShiftWithClient constructs a fake client associated with the stateful fake in-memory OpenShift reactors. The fake OpenShift is available for direct interaction, so you can make buggy states.
func (*FakeOpenShift) AddReactorsTo ¶
func (fos *FakeOpenShift) AddReactorsTo(c *imagefakeclient.FakeImageV1)
AddReactorsTo binds the reactors to client.
func (*FakeOpenShift) CreateImage ¶
func (fos *FakeOpenShift) CreateImage(image *imageapiv1.Image) (*imageapiv1.Image, error)
func (*FakeOpenShift) CreateImageStream ¶
func (fos *FakeOpenShift) CreateImageStream(namespace string, is *imageapiv1.ImageStream) (*imageapiv1.ImageStream, error)
func (*FakeOpenShift) CreateImageStreamMapping ¶
func (fos *FakeOpenShift) CreateImageStreamMapping(namespace string, ism *imageapiv1.ImageStreamMapping) (*imageapiv1.ImageStreamMapping, error)
func (*FakeOpenShift) CreateImageStreamTag ¶
func (fos *FakeOpenShift) CreateImageStreamTag(namespace string, istag *imageapiv1.ImageStreamTag) (*imageapiv1.ImageStreamTag, error)
func (*FakeOpenShift) GetImage ¶
func (fos *FakeOpenShift) GetImage(name string) (*imageapiv1.Image, error)
func (*FakeOpenShift) GetImageStream ¶
func (fos *FakeOpenShift) GetImageStream(namespace, repo string) (*imageapiv1.ImageStream, error)
func (*FakeOpenShift) GetImageStreamImage ¶
func (fos *FakeOpenShift) GetImageStreamImage(namespace string, id string) (*imageapiv1.ImageStreamImage, error)
func (*FakeOpenShift) UpdateImage ¶
func (fos *FakeOpenShift) UpdateImage(image *imageapiv1.Image) (*imageapiv1.Image, error)
func (*FakeOpenShift) UpdateImageStream ¶
func (fos *FakeOpenShift) UpdateImageStream(namespace string, is *imageapiv1.ImageStream) (*imageapiv1.ImageStream, error)
type ManifestSchemaVersion ¶
type ManifestSchemaVersion int
const ( ManifestSchema1 ManifestSchemaVersion = 1 ManifestSchema2 ManifestSchemaVersion = 2 )