Documentation
¶
Index ¶
- Constants
- Variables
- func AssertTests(t *testing.T)
- func CaptureTestcase(k *Keploy, r *http.Request, reqBody []byte, resp models.HttpResp, ...)
- func Decode(bin []byte, obj interface{}) (interface{}, error)
- func Encode(obj interface{}, arr [][]byte, pos int) error
- func GetMode() keploy.Mode
- func Middleware(k *Keploy, router Router) error
- func ProcessDep(ctx context.Context, log *zap.Logger, meta map[string]string, ...) (bool, []interface{})
- func SetTestMode()
- type AppConfig
- type BodyDumpResponseWriter
- type Config
- type Filter
- type HttpResp
- type KError
- type Keploy
- func (k *Keploy) Capture(req regression.TestCaseReq)
- func (k *Keploy) Get(id string) *models.TestCase
- func (k *Keploy) GetClock(id string) int64
- func (k *Keploy) GetDependencies(id string) []models.Dependency
- func (k *Keploy) GetMocks(id string) []*proto.Mock
- func (k *Keploy) GetResp(id string) HttpResp
- func (k *Keploy) PutResp(id string, resp HttpResp)
- func (k *Keploy) Test()
- type Router
- type ServerConfig
Constants ¶
Variables ¶
var (
RespChannels = map[string]chan bool{}
)
Functions ¶
func AssertTests ¶ added in v0.2.0
func CaptureTestcase ¶ added in v0.2.0
func Encode ¶
Encode takes obj parameter and encodes its contents into arr parameter. If obj have no exported field then, it returns an error.
func Middleware ¶ added in v0.4.3
func ProcessDep ¶
func ProcessDep(ctx context.Context, log *zap.Logger, meta map[string]string, outputs ...interface{}) (bool, []interface{})
ProcessDep is a generic method to encode and decode the outputs of external dependecies. If request is on keploy.MODE_TEST mode, it returns (true, decoded outputs of stored binaries in keploy context). Else in keploy.MODE_RECORD mode, it encodes the outputs of external dependencies and stores in keploy context. Returns (false, nil).
func SetTestMode ¶ added in v0.2.0
func SetTestMode()
SetTestMode sets the keploy SDK mode to MODE_TEST
Types ¶
type BodyDumpResponseWriter ¶ added in v0.2.0
type BodyDumpResponseWriter struct {
io.Writer
http.ResponseWriter
Status int
}
func ProcessRequest ¶ added in v0.4.0
func (*BodyDumpResponseWriter) Flush ¶ added in v0.2.0
func (w *BodyDumpResponseWriter) Flush()
func (*BodyDumpResponseWriter) Hijack ¶ added in v0.2.0
func (w *BodyDumpResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error)
func (*BodyDumpResponseWriter) Write ¶ added in v0.2.0
func (w *BodyDumpResponseWriter) Write(b []byte) (int, error)
func (*BodyDumpResponseWriter) WriteHeader ¶ added in v0.2.0
func (w *BodyDumpResponseWriter) WriteHeader(code int)
type Config ¶ added in v0.2.0
type Config struct {
App AppConfig
Server ServerConfig
}
type KError ¶
type KError struct {
Err error
}
KError stores the error for encoding and decoding as errorString has no exported fields due to gob wasn't able to encode the unexported fields.
type Keploy ¶ added in v0.2.0
type Keploy struct {
Ctx context.Context
Log *zap.Logger
// contains filtered or unexported fields
}
func (*Keploy) Capture ¶ added in v0.2.0
func (k *Keploy) Capture(req regression.TestCaseReq)
Capture will capture request, response and output of external dependencies by making Call to keploy server.
func (*Keploy) GetDependencies ¶ added in v0.2.1
func (k *Keploy) GetDependencies(id string) []models.Dependency
type Router ¶ added in v0.4.3
type Router interface {
GetRequest() *http.Request // GetRequest provides access to the current http request object. Example: echo.Context.Request()
SetRequest(*http.Request) // SetRequest sets the http request with given request object parameter.
GetResponseWriter() http.ResponseWriter // GetResponseWriter returns current ResponseWriter of the http handler.
SetResponseWriter(http.ResponseWriter) // SetResponseWriter sets the ResponseWriter of http handler with given parameter.
Context() context.Context // Context returns the underlying context of the http.Request.
Next() error // Next is used to call the next handler of the middleware chain.
GetURLParams() map[string]string // GetURLParams returns the url parameter as key:value pair.
}