fake

package
v0.27.6 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RegistrationToken = "fake-registration-token"

	RunnersListBody = `` /* 208-byte string literal not displayed */

)

Variables

This section is empty.

Functions

func NewServer

func NewServer(opts ...Option) *httptest.Server

NewServer creates a fake server for running unit tests

Types

type FixedResponses

type FixedResponses struct {
	ListRepositoryWorkflowRuns *Handler
	ListWorkflowJobs           *MapHandler
	ListRunners                http.Handler
}

type Handler

type Handler struct {
	Status int
	Body   string

	Statuses map[string]string
}

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, req *http.Request)

type ListRunnersHandler

type ListRunnersHandler struct {
	Status int
	Body   string
}

func DefaultListRunnersHandler

func DefaultListRunnersHandler() *ListRunnersHandler

func (*ListRunnersHandler) ServeHTTP

func (h *ListRunnersHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)

type MapHandler

type MapHandler struct {
	Status int
	Bodies map[int]string
}

func (*MapHandler) ServeHTTP

func (h *MapHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)

type Option

type Option func(*ServerConfig)

func WithFixedResponses

func WithFixedResponses(responses *FixedResponses) Option

func WithListRepositoryWorkflowRunsResponse

func WithListRepositoryWorkflowRunsResponse(status int, body, queued, in_progress string) Option

func WithListRunnersResponse

func WithListRunnersResponse(status int, body string) Option

func WithListWorkflowJobsResponse

func WithListWorkflowJobsResponse(status int, bodies map[int]string) Option

type RunnersList

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

func NewRunnersList

func NewRunnersList() *RunnersList

func (*RunnersList) Add

func (r *RunnersList) Add(runner *github.Runner)

func (*RunnersList) AddOffline

func (r *RunnersList) AddOffline(runners []v1alpha1.Runner)

func (*RunnersList) GetServer

func (r *RunnersList) GetServer() *httptest.Server

func (*RunnersList) HandleList

func (r *RunnersList) HandleList() http.HandlerFunc

func (*RunnersList) Sync

func (r *RunnersList) Sync(runners []v1alpha1.Runner)

type ServerConfig

type ServerConfig struct {
	*FixedResponses
}

Jump to

Keyboard shortcuts

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