test

package
v0.60.1 Latest Latest
Warning

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

Go to latest
Published: May 27, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RawRequest

type RawRequest struct {
	ResolverPayload resource.ResolverPayload
}

RawRequest stores the raw request data

func (*RawRequest) Request

func (r *RawRequest) Request() resource.Request

Request returns a Request interface based on the RawRequest.

type Request

type Request struct {
	RawRequest
}

Request implements resolution.Request and makes it easier to mock input for submit Using inline structs is to avoid conflicts between field names and method names.

func NewRequest

func NewRequest(resolverPayload resource.ResolverPayload) *Request

NewRequest creates a mock request that is populated with the given name namespace and params

func (*Request) ResolverPayload

func (r *Request) ResolverPayload() resource.ResolverPayload

Params implements resolution.Request and returns the mock params given to it on initialization.

type Requester

type Requester struct {
	// The resolved resource object to return when a request is
	// submitted.
	ResolvedResource resolution.ResolvedResource
	// An error to return when a request is submitted.
	SubmitErr error
	// ResolverPayload that should match that of the request in order to return the resolved resource
	ResolverPayload resource.ResolverPayload
}

Requester implements resolution.Requester and makes it easier to mock the outcome of a remote pipelineRef or taskRef resolution.

func NewRequester

func NewRequester(resource resolution.ResolvedResource, err error, resolverPayload resource.ResolverPayload) *Requester

NewRequester creates a mock requester that resolves to the given resource or returns the given error on Submit().

func (*Requester) Submit

Submit implements resolution.Requester, accepting the name of a resolver and a request for a specific remote file, and then returns whatever mock data was provided on initialization.

type ResolvedResource

type ResolvedResource struct {
	// The resolved bytes to return when resolution is complete.
	ResolvedData []byte
	// An error to return instead of the resolved bytes after
	// resolution completes.
	DataErr error
	// Annotations to return when resolution is complete.
	ResolvedAnnotations map[string]string
	// ResolvedRefSource to return the source reference of the remote data
	ResolvedRefSource *pipelinev1.RefSource
}

ResolvedResource implements resolution.ResolvedResource and makes it easier to mock the resolved content of a fetched pipeline or task.

func NewResolvedResource

func NewResolvedResource(data []byte, annotations map[string]string, source *pipelinev1.RefSource, dataErr error) *ResolvedResource

NewResolvedResource creates a mock resolved resource that is populated with the given data and annotations or returns the given error from its Data() method.

func (*ResolvedResource) Annotations

func (r *ResolvedResource) Annotations() map[string]string

Annotations implements resolution.ResolvedResource and returns the mock annotations given to it on initialization.

func (*ResolvedResource) Data

func (r *ResolvedResource) Data() ([]byte, error)

Data implements resolution.ResolvedResource and returns the mock data and/or error given to it on initialization.

func (*ResolvedResource) RefSource

func (r *ResolvedResource) RefSource() *pipelinev1.RefSource

RefSource is the source reference of the remote data that records where the remote file came from including the url, digest and the entrypoint.

Jump to

Keyboard shortcuts

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