test

package
v0.0.0-...-3da42c7 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateHTTPClient

func CreateHTTPClient(handler http.Handler) (*http.Client, func())

CreateHTTPClient create a fake http client for integration tests

func CreateHTTPSClient

func CreateHTTPSClient(handler http.Handler) (*http.Client, string, func())

CreateHTTPSClient creates a test client with a httptest server that responds to API calls

func CreateHandler

func CreateHandler(response []byte, statusCode int) http.Handler

Types

type CombinedURLHandler

type CombinedURLHandler struct {
	// contains filtered or unexported fields
}

func NewCombinedURLHandler

func NewCombinedURLHandler(t *testing.T) *CombinedURLHandler

func (*CombinedURLHandler) AddExactError

func (h *CombinedURLHandler) AddExactError(url string, statusCode int, fileName string)

func (*CombinedURLHandler) AddExactFile

func (h *CombinedURLHandler) AddExactFile(url string, fileName string)

func (*CombinedURLHandler) AddExactTemplate

func (h *CombinedURLHandler) AddExactTemplate(url string, templateFilename string, templatingData interface{})

func (*CombinedURLHandler) ServeHTTP

func (h *CombinedURLHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type EmptyURLHandler

type EmptyURLHandler struct {
	// contains filtered or unexported fields
}

EmptyURLHandler is an implementation of http.Handler that will not handle anything.

func NewEmptyURLHandler

func NewEmptyURLHandler(t *testing.T) *EmptyURLHandler

NewEmptyURLHandler creates a new EmptyURLHandler instance.

func (*EmptyURLHandler) ServeHTTP

func (h *EmptyURLHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type EventData

type EventData struct {
	Context string
	Source  string
	Event   string

	Project            string
	Stage              string
	Service            string
	Deployment         string
	TestStrategy       string
	DeploymentStrategy string

	Labels map[string]string
}

func (*EventData) GetDeployment

func (e *EventData) GetDeployment() string

GetDeployment returns the name of the deployment

func (EventData) GetDeploymentStrategy

func (e EventData) GetDeploymentStrategy() string

GetDeploymentStrategy returns the used deployment strategy

func (*EventData) GetEvent

func (e *EventData) GetEvent() string

GetEvent returns the event type

func (*EventData) GetLabels

func (e *EventData) GetLabels() map[string]string

GetLabels returns a map of labels

func (*EventData) GetProject

func (e *EventData) GetProject() string

GetProject returns the project

func (*EventData) GetService

func (e *EventData) GetService() string

GetService returns the service

func (*EventData) GetShKeptnContext

func (e *EventData) GetShKeptnContext() string

GetShKeptnContext returns the shkeptncontext

func (*EventData) GetSource

func (e *EventData) GetSource() string

GetSource returns the source specified in the CloudEvent context

func (*EventData) GetStage

func (e *EventData) GetStage() string

GetStage returns the stage

func (*EventData) GetTestStrategy

func (e *EventData) GetTestStrategy() string

GetTestStrategy returns the used test strategy

type FileBasedURLHandler

type FileBasedURLHandler struct {
	// contains filtered or unexported fields
}

func NewFileBasedURLHandler

func NewFileBasedURLHandler(t *testing.T) *FileBasedURLHandler

func (*FileBasedURLHandler) AddExact

func (h *FileBasedURLHandler) AddExact(url string, fileName string)

func (*FileBasedURLHandler) AddExactError

func (h *FileBasedURLHandler) AddExactError(url string, statusCode int, fileName string)

func (*FileBasedURLHandler) ServeHTTP

func (h *FileBasedURLHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type FileBasedURLHandlerWithSink

type FileBasedURLHandlerWithSink struct {
	*FileBasedURLHandler
	// contains filtered or unexported fields
}

FileBasedURLHandlerWithSink encapsulates a FileBasedURLHandler and contains a sink for any data that would be sent to the server in the request body

func NewFileBasedURLHandlerWithSink

func NewFileBasedURLHandlerWithSink(t *testing.T) *FileBasedURLHandlerWithSink

NewFileBasedURLHandlerWithSink creates a new FileBasedURLHandlerWithSink instance

func (*FileBasedURLHandlerWithSink) GetStoredPayloadForURL

func (h *FileBasedURLHandlerWithSink) GetStoredPayloadForURL(url string, container interface{})

GetStoredPayloadForURL unmarshals the payload found for the exact url into the container or fails if it could not find an exact url match.

func (*FileBasedURLHandlerWithSink) ServeHTTP

type PayloadBasedURLHandler

type PayloadBasedURLHandler struct {
	// contains filtered or unexported fields
}

func NewPayloadBasedURLHandler

func NewPayloadBasedURLHandler(t *testing.T) *PayloadBasedURLHandler

func (*PayloadBasedURLHandler) AddExact

func (h *PayloadBasedURLHandler) AddExact(url string, payload []byte)

func (*PayloadBasedURLHandler) AddExactError

func (h *PayloadBasedURLHandler) AddExactError(url string, statusCode int, payload []byte)

func (*PayloadBasedURLHandler) ServeHTTP

type TemplatingPayloadBasedURLHandler

type TemplatingPayloadBasedURLHandler struct {
	// contains filtered or unexported fields
}

TemplatingPayloadBasedURLHandler encapsulates a payload-based URL handler and extends its with templating functionality

func NewTemplatingPayloadBasedURLHandler

func NewTemplatingPayloadBasedURLHandler(t *testing.T) *TemplatingPayloadBasedURLHandler

NewTemplatingPayloadBasedURLHandler creates a new TemplatingPayloadBasedURLHandler

func (*TemplatingPayloadBasedURLHandler) AddExact

func (h *TemplatingPayloadBasedURLHandler) AddExact(url string, templateFilename string, templatingData interface{})

AddExact will add an exact match handler for a given url, using a template file and templatingData to produce a byte[] payload

func (*TemplatingPayloadBasedURLHandler) AddExactError

func (h *TemplatingPayloadBasedURLHandler) AddExactError(url string, statusCode int, templateFilename string, templatingData interface{})

AddExactError will add an exact match error handler for a given url, including an error status code using a template file and templatingData to produce a byte[] payload

func (*TemplatingPayloadBasedURLHandler) ServeHTTP

Jump to

Keyboard shortcuts

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