test

package
v1.8.6 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2019 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckSetsEqual added in v1.8.2

func CheckSetsEqual(setA, setB []int) bool

CheckSetsEqual - check int set if they are equals

func GenerateKey

func GenerateKey(path string) (string, error)

GenerateKey generates aes key

func GetDefaultConfigMap

func GetDefaultConfigMap() map[string]interface{}

GetDefaultConfigMap returns the defailt config map for easier modification.

func GetUnitTestConfig added in v1.8.0

func GetUnitTestConfig() map[string]interface{}

GetUnitTestConfig ...

func Handler

func Handler(resp *Response) func(http.ResponseWriter, *http.Request)

Handler returns a handler function which handle requst according to the response provided

func InitDatabaseFromEnv

func InitDatabaseFromEnv()

InitDatabaseFromEnv is used to initialize database for testing

func NewRegistryCtl added in v1.6.0

func NewRegistryCtl(config map[string]interface{}) (*httptest.Server, error)

NewRegistryCtl returns a mock registry server

func NewServer

func NewServer(mappings ...*RequestHandlerMapping) *httptest.Server

NewServer creates a HTTP server for unit test

func TraceCfgMap added in v1.8.0

func TraceCfgMap(cfgs map[string]interface{})

TraceCfgMap ...

Types

type GCResult added in v1.6.0

type GCResult struct {
	Status    bool      `json:"status"`
	Msg       string    `json:"msg"`
	StartTime time.Time `json:"starttime"`
	EndTime   time.Time `json:"endtime"`
}

GCResult ...

type RequestHandlerMapping

type RequestHandlerMapping struct {
	// Method is the method the request used
	Method string
	// Pattern is the pattern the request must match
	Pattern string
	// Handler is the handler which handles the request
	Handler func(http.ResponseWriter, *http.Request)
}

RequestHandlerMapping is a mapping between request and its handler

func (*RequestHandlerMapping) ServeHTTP

func (rhm *RequestHandlerMapping) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP ...

type Response

type Response struct {
	// StatusCode is the status code of the response
	StatusCode int
	// Headers are the headers of the response
	Headers map[string]string
	// Boby is the body of the response
	Body []byte
}

Response is a response used for unit test

Jump to

Keyboard shortcuts

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