test

package
v0.61.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 License: Apache-2.0 Imports: 8 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 {
	// the request name
	Name string
	// the request namespace
	Namespace string
	// the params for the request
	Params []pipelinev1.Param
}

RawRequest stores the raw request data

func (*RawRequest) Request

func (r *RawRequest) Request() common.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(name, namespace string, params []pipelinev1.Param) *Request

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

func (*Request) Name

func (r *Request) Name() string

Name implements resolution.Request and returns the mock name given to it on initialization.

func (*Request) Namespace

func (r *Request) Namespace() string

Namespace implements resolution.Request and returns the mock namespace given to it on initialization.

func (*Request) Params

func (r *Request) Params() pipelinev1.Params

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 common.ResolvedResource
	// An error to return when a request is submitted.
	SubmitErr error
	// Params that should match those on the request in order to return the resolved resource
	Params []pipelinev1.Param
}

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

func NewRequester

func NewRequester(resource common.ResolvedResource, err error) *Requester

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

func (*Requester) Submit

func (r *Requester) Submit(ctx context.Context, resolverName common.ResolverName, req common.Request) (common.ResolvedResource, error)

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