server

package
v0.0.0-...-8fb13b5 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2019 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogHandlerFunc

func LogHandlerFunc(next http.HandlerFunc) http.HandlerFunc

LogHandlerFunc logs request/response information.

Types

type Error

type Error struct {
	Error string `json:"error"`
}

Error is the api representation of an error.

type Option

type Option func(*options)

Option is used to inject dependencies into a Server on creation.

func WithS3

func WithS3(s3 *S3) Option

type ResponseInspectingWriter

type ResponseInspectingWriter struct {
	http.ResponseWriter
	Status int
}

ResponseInspectingWriter is an http.ResponseWriter that captures response info.

func (*ResponseInspectingWriter) Write

func (w *ResponseInspectingWriter) Write(p []byte) (int, error)

Write wraps the method for writing response bodies..

func (*ResponseInspectingWriter) WriteHeader

func (w *ResponseInspectingWriter) WriteHeader(s int)

WriteHeader wraps the method capturing the response status code.

type S3

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

S3 implements state storage in a s3 compatible backend.

func NewS3

func NewS3(bucket string, config *aws.Config) *S3

NewS3 constructs a new S3.

func (*S3) Load

func (s *S3) Load(ctx context.Context) ([]*e2e.Test, []*e2e.Benchmark, error)

Load fetches test and benchmark state from s3.

func (*S3) Save

func (s *S3) Save(ctx context.Context, tests []*e2e.Test, benchmarks []*e2e.Benchmark) error

Save stores test and benchmark state in s3.

type Server

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

server present both an api for receiving e2e run result submissions as well as an html frontend for viewing run results.

func New

func New(opts ...Option) *Server

New constructs a new `Server`.

func (*Server) ExecuteTemplate

func (s *Server) ExecuteTemplate(name string, w io.Writer, value interface{}) error

ExecuteTemplate runs the given template with the value

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serves the html frontend and http api.

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

Shutdown handles any shutdown specific operations. If s3 is configured, an attempt will be made to save the state.

Jump to

Keyboard shortcuts

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