models

package
v2.1.0-alpha9 Latest Latest
Warning

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

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

README

Models Package Documentation

This package defines all the Go structs used for storing the captured data. It is designed as an independent module.

Documentation

Overview

Package models provides data models for the keploy.

Index

Constants

View Source
const (
	NoSQLDB             string = "NO_SQL_DB"
	SQLDB               string = "SQL_DB"
	GRPC                string = "GRPC"
	HTTPClient          string = "HTTP_CLIENT"
	TestSetPattern      string = "test-set-"
	String              string = "string"
	TestRunTemplateName string = "test-run-"
)

Patterns for different usecases in keploy

View Source
const (
	TypeDecimal    byte = 0x00
	TypeTiny       byte = 0x01
	TypeShort      byte = 0x02
	TypeLong       byte = 0x03
	TypeFloat      byte = 0x04
	TypeDouble     byte = 0x05
	TypeNull       byte = 0x06
	TypeTimestamp  byte = 0x07
	TypeLongLong   byte = 0x08
	TypeInt24      byte = 0x09
	TypeDate       byte = 0x0a
	TypeTime       byte = 0x0b
	TypeDateTime   byte = 0x0c
	TypeYear       byte = 0x0d
	TypeNewDate    byte = 0x0e
	TypeVarChar    byte = 0x0f
	TypeBit        byte = 0x10
	TypeNewDecimal byte = 0xf6
	TypeEnum       byte = 0xf7
	TypeSet        byte = 0xf8
	TypeTinyBlob   byte = 0xf9
	TypeMediumBlob byte = 0xfa
	TypeLongBlob   byte = 0xfb
	TypeBlob       byte = 0xfc
	TypeVarString  byte = 0xfd
	TypeString     byte = 0xfe
	TypeGeometry   byte = 0xff
)

MySQL constants

View Source
const (
	HeaderSize         = 1024
	OKPacketResulSet   = 0x00
	EOFPacketResultSet = 0xfe
	LengthEncodedInt   = 0xfb
)

MySQL constants

View Source
const (
	OK               = 0x00
	ERR              = 0xff
	LocalInFile      = 0xfb
	EOF         byte = 0xfe
)

MySQL constants

View Source
const (
	AuthMoreData                                 byte = 0x01
	CachingSha2PasswordRequestPublicKey          byte = 2
	CachingSha2PasswordFastAuthSuccess           byte = 3
	CachingSha2PasswordPerformFullAuthentication byte = 4
)

MySQL constants

View Source
const (
	CLIENT_LONG_PASSWORD CapabilityFlags = 1 << iota
	CLIENT_FOUND_ROWS
	CLIENT_LONG_FLAG
	CLIENT_CONNECT_WITH_DB
	CLIENT_NO_SCHEMA
	CLIENT_COMPRESS
	CLIENT_ODBC
	CLIENT_LOCAL_FILES
	CLIENT_IGNORE_SPACE
	CLIENT_PROTOCOL_41
	CLIENT_INTERACTIVE
	CLIENT_SSL = 0x00000800
	CLIENT_IGNORE_SIGPIPE
	CLIENT_TRANSACTIONS
	CLIENT_RESERVED
	CLIENT_SECURE_CONNECTION
	CLIENT_MULTI_STATEMENTS = 1 << (iota + 2)
	CLIENT_MULTI_RESULTS
	CLIENT_PS_MULTI_RESULTS
	CLIENT_PLUGIN_AUTH
	CLIENT_CONNECT_ATTRS
	CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA
	CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS
	CLIENT_SESSION_TRACK
	CLIENT_DEPRECATE_EOF
)

MySQL constants

View Source
const (
	MODE_RECORD Mode     = "record"
	MODE_TEST   Mode     = "test"
	MODE_OFF    Mode     = "off"
	KCTX        KctxType = "KeployContext"
	KTime       KctxType = "KeployTime"
)

constants for keploy mode

View Source
const (
	HTTP           Kind     = "Http"
	GENERIC        Kind     = "Generic"
	SQL            Kind     = "SQL"
	Postgres       Kind     = "Postgres"
	GRPC_EXPORT    Kind     = "gRPC"
	Mongo          Kind     = "Mongo"
	BodyTypeUtf8   BodyType = "utf-8"
	BodyTypeBinary BodyType = "binary"
	BodyTypePlain  BodyType = "PLAIN"
	BodyTypeJSON   BodyType = "JSON"
	BodyTypeError  BodyType = "ERROR"
)

mocks types

View Source
const ClientConnectionIDKey contextKey = "clientConnectionId"
View Source
const DestConnectionIDKey contextKey = "destConnectionId"
View Source
const ErrGroupKey contextKey = "errGroup"
View Source
const (
	MaxPacketSize = 1<<24 - 1
)

MySQL constants

View Source
const ProtocolVersionNumber uint32 = 196608

ProtocolVersionNumber should be replaced with actual version number if different

View Source
const V1Beta1 = Version("api.keploy.io/v1beta1")

Variables

View Source
var BaseTime = time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC)
View Source
var FailingColorScheme = pp.ColorScheme{
	Bool:            pp.Cyan | pp.Bold,
	Integer:         pp.Blue | pp.Bold,
	Float:           pp.Magenta | pp.Bold,
	String:          pp.Red,
	StringQuotation: pp.Red | pp.Bold,
	EscapedChar:     pp.Magenta | pp.Bold,
	FieldName:       pp.Yellow,
	PointerAdress:   pp.Blue | pp.Bold,
	Nil:             pp.Cyan | pp.Bold,
	Time:            pp.Blue | pp.Bold,
	StructName:      pp.White,
	ObjectLength:    pp.Blue,
}
View Source
var HighlightFailingString = color.New(color.FgRed).SprintFunc()
View Source
var HighlightGrayString = color.New(color.FgHiBlack).SprintFunc()
View Source
var HighlightPassingString = color.New(color.FgGreen).SprintFunc()
View Source
var HighlightString = color.New(orangeColorSGR...).SprintFunc()
View Source
var (
	PassThroughHosts = []string{"^dc\\.services\\.visualstudio\\.com$"}
)
View Source
var PassingColorScheme = pp.ColorScheme{
	String:          pp.Green,
	StringQuotation: pp.Green | pp.Bold,
	FieldName:       pp.White,
	Integer:         pp.Blue | pp.Bold,
	StructName:      pp.NoColor,
	Bool:            pp.Cyan | pp.Bold,
	Float:           pp.Magenta | pp.Bold,
	EscapedChar:     pp.Magenta | pp.Bold,
	PointerAdress:   pp.Blue | pp.Bold,
	Nil:             pp.Cyan | pp.Bold,
	Time:            pp.Blue | pp.Bold,
	ObjectLength:    pp.Blue,
}

Functions

func SetMode

func SetMode(m Mode) error

SetMode sets the keploy SDK mode error is returned if the mode is invalid

func SetTestMode

func SetTestMode()

SetTestMode sets the keploy SDK mode to MODE_TEST

func SetVersion

func SetVersion(V1 string)

Types

type AbsResult

type AbsResult struct {
	Kind       StringResult `json:"kind" bson:"kind" yaml:"kind"`
	Name       StringResult `json:"name" bson:"name" yaml:"name"`
	Req        ReqCompare   `json:"req" bson:"req" yaml:"req"`
	Resp       RespCompare  `json:"resp" bson:"resp" yaml:"resp"`
	CurlResult StringResult `json:"curl_result" bson:"curl_result" yaml:"curl_result"`
}

type AppError

type AppError struct {
	AppErrorType AppErrorType
	Err          error
}

func (AppError) Error

func (e AppError) Error() string

type AppErrorType

type AppErrorType string
const (
	ErrCommandError   AppErrorType = "exited due to command error"
	ErrUnExpected     AppErrorType = "an unexpected error occurred"
	ErrInternal       AppErrorType = "an internal error occurred"
	ErrAppStopped     AppErrorType = "app stopped"
	ErrCtxCanceled    AppErrorType = "context canceled"
	ErrTestBinStopped AppErrorType = "test binary stopped"
)

AppErrorType is a type of error that can be returned by the application

type AuthSwitchRequestPacket

type AuthSwitchRequestPacket struct {
	StatusTag      byte   `json:"status_tag,omitempty" yaml:"status_tag,omitempty,flow" bson:"status_tag,omitempty"`
	PluginName     string `json:"plugin_name,omitempty" yaml:"plugin_name,omitempty,flow" bson:"plugin_name,omitempty"`
	PluginAuthData string `json:"plugin_authdata,omitempty" yaml:"plugin_authdata,omitempty,flow" bson:"plugin_authdata,omitempty"`
}

type AuthSwitchResponsePacket

type AuthSwitchResponsePacket struct {
	AuthResponseData string `json:"auth_response_data,omitempty" yaml:"auth_response_data,omitempty,flow" bson:"auth_response_data,omitempty"`
}

type Backend

type Backend struct {
	PacketTypes         []string                     `json:"header,omitempty" yaml:"header,omitempty,flow"`
	Identfier           string                       `json:"identifier,omitempty" yaml:"identifier,omitempty"`
	Length              uint32                       `json:"length,omitempty" yaml:"length,omitempty"`
	Payload             string                       `json:"payload,omitempty" yaml:"payload,omitempty"`
	Bind                pgproto3.Bind                `yaml:"-"`
	Binds               []pgproto3.Bind              `json:"bind,omitempty" yaml:"bind,omitempty"`
	CancelRequest       pgproto3.CancelRequest       `json:"cancel_request,omitempty" yaml:"cancel_request,omitempty"`
	Close               pgproto3.Close               `json:"close,omitempty" yaml:"close,omitempty"`
	CopyFail            pgproto3.CopyFail            `json:"copy_fail,omitempty" yaml:"copy_fail,omitempty"`
	CopyData            pgproto3.CopyData            `json:"copy_data,omitempty" yaml:"copy_data,omitempty"`
	CopyDone            pgproto3.CopyDone            `json:"copy_done,omitempty" yaml:"copy_done,omitempty"`
	Describe            pgproto3.Describe            `json:"describe,omitempty" yaml:"describe,omitempty"`
	Execute             pgproto3.Execute             `yaml:"-"`
	Executes            []pgproto3.Execute           `json:"execute,omitempty" yaml:"execute,omitempty"`
	Flush               pgproto3.Flush               `json:"flush,omitempty" yaml:"flush,omitempty"`
	FunctionCall        pgproto3.FunctionCall        `json:"function_call,omitempty" yaml:"function_call,omitempty"`
	GssEncRequest       pgproto3.GSSEncRequest       `json:"gss_enc_request,omitempty" yaml:"gss_enc_request,omitempty"`
	Parse               pgproto3.Parse               `yaml:"-"`
	Parses              []pgproto3.Parse             `json:"parse,omitempty" yaml:"parse,omitempty"`
	Query               pgproto3.Query               `json:"query,omitempty" yaml:"query,omitempty"`
	SSlRequest          pgproto3.SSLRequest          `json:"ssl_request,omitempty" yaml:"ssl_request,omitempty"`
	StartupMessage      pgproto3.StartupMessage      `json:"startup_message,omitempty" yaml:"startup_message,omitempty"`
	Sync                pgproto3.Sync                `json:"sync,omitempty" yaml:"sync,omitempty"`
	Terminate           pgproto3.Terminate           `json:"terminate,omitempty" yaml:"terminate,omitempty"`
	SASLInitialResponse pgproto3.SASLInitialResponse `json:"sasl_initial_response,omitempty" yaml:"sasl_initial_response,omitempty"`
	SASLResponse        pgproto3.SASLResponse        `json:"sasl_response,omitempty" yaml:"sasl_response,omitempty"`
	PasswordMessage     pgproto3.PasswordMessage     `json:"password_message,omitempty" yaml:"password_message,omitempty"`
	MsgType             byte                         `json:"msg_type,omitempty" yaml:"msg_type,omitempty"`
	PartialMsg          bool                         `json:"partial_msg,omitempty" yaml:"partial_msg,omitempty"`
	AuthType            int32                        `json:"auth_type" yaml:"auth_type"`
	BodyLen             int                          `json:"body_len,omitempty" yaml:"body_len,omitempty"`
}

Backend is PG Request Packet Transcoder

type BodyResult

type BodyResult struct {
	Normal   bool     `json:"normal" bson:"normal" yaml:"normal"`
	Type     BodyType `json:"type" bson:"type" yaml:"type"`
	Expected string   `json:"expected" bson:"expected" yaml:"expected"`
	Actual   string   `json:"actual" bson:"actual" yaml:"actual"`
}

type BodyType

type BodyType string

type BoundParameter

type BoundParameter struct {
	Type     byte   `json:"type,omitempty" yaml:"type,omitempty,flow" bson:"type,omitempty"`
	Unsigned byte   `json:"unsigned,omitempty" yaml:"unsigned,omitempty,flow" bson:"unsigned,omitempty"`
	Value    []byte `json:"value,omitempty" yaml:"value,omitempty,flow" bson:"value,omitempty"`
}

type CapabilityFlags

type CapabilityFlags uint32

type ColumnDefinition

type ColumnDefinition struct {
	Catalog      string       `json:"catalog,omitempty" yaml:"catalog,omitempty,flow" bson:"catalog,omitempty"`
	Schema       string       `json:"schema,omitempty" yaml:"schema,omitempty,flow" bson:"schema,omitempty"`
	Table        string       `json:"table,omitempty" yaml:"table,omitempty,flow" bson:"table,omitempty"`
	OrgTable     string       `json:"org_table,omitempty" yaml:"org_table,omitempty,flow" bson:"org_table,omitempty"`
	Name         string       `json:"name,omitempty" yaml:"name,omitempty,flow" bson:"name,omitempty"`
	OrgName      string       `json:"org_name,omitempty" yaml:"org_name,omitempty,flow" bson:"org_name,omitempty"`
	NextLength   uint64       `json:"next_length,omitempty" yaml:"next_length,omitempty,flow" bson:"next_length,omitempty"`
	CharacterSet uint16       `json:"character_set,omitempty" yaml:"character_set,omitempty,flow" bson:"character_set,omitempty"`
	ColumnLength uint32       `json:"column_length,omitempty" yaml:"column_length,omitempty,flow" bson:"column_length,omitempty"`
	ColumnType   byte         `json:"column_type,omitempty" yaml:"column_type,omitempty,flow" bson:"column_type,omitempty"`
	Flags        uint16       `json:"flags,omitempty" yaml:"flags,omitempty,flow" bson:"flags,omitempty"`
	Decimals     byte         `json:"decimals,omitempty" yaml:"decimals,omitempty,flow" bson:"decimals,omitempty"`
	PacketHeader PacketHeader `json:"packet_header,omitempty" yaml:"packet_header,omitempty,flow" bson:"packet_header,omitempty"`
}

type DepMetaResult

type DepMetaResult struct {
	Normal   bool   `json:"normal" bson:"normal" yaml:"normal"`
	Key      string `json:"key" bson:"key" yaml:"key"`
	Expected string `json:"expected" bson:"expected" yaml:"expected"`
	Actual   string `json:"actual" bson:"actual" yaml:"actual"`
}

type DepResult

type DepResult struct {
	Name string          `json:"name" bson:"name" yaml:"name"`
	Type string          `json:"type" bson:"type" yaml:"type"`
	Meta []DepMetaResult `json:"meta" bson:"meta" yaml:"meta"`
}

type FieldType

type FieldType byte
const (
	FieldTypeDecimal FieldType = iota
	FieldTypeTiny
	FieldTypeShort
	FieldTypeLong
	FieldTypeFloat
	FieldTypeDouble
	FieldTypeNULL
	FieldTypeTimestamp
	FieldTypeLongLong
	FieldTypeInt24
	FieldTypeDate
	FieldTypeTime
	FieldTypeDateTime
	FieldTypeYear
	FieldTypeNewDate
	FieldTypeVarChar
	FieldTypeBit
)

MySQL constants

const (
	FieldTypeJSON FieldType = iota + 0xf5
	FieldTypeNewDecimal
	FieldTypeEnum
	FieldTypeSet
	FieldTypeTinyBLOB
	FieldTypeMediumBLOB
	FieldTypeLongBLOB
	FieldTypeBLOB
	FieldTypeVarString
	FieldTypeString
	FieldTypeGeometry
)

MySQL constants

type Filters

type Filters struct {
	Path       string            `json:"path" yaml:"path"`
	URLMethods []string          `json:"urlMethods" yaml:"urlMethods"`
	Host       string            `json:"host" yaml:"host"`
	Headers    map[string]string `json:"headers" yaml:"headers"`
	Port       uint              `json:"ports" yaml:"ports"`
}

type FormData

type FormData struct {
	Key    string   `json:"key" bson:"key" yaml:"key"`
	Values []string `json:"values" bson:"values,omitempty" yaml:"values,omitempty"`
	Paths  []string `json:"paths" bson:"paths,omitempty" yaml:"paths,omitempty"`
}

type Frame

type Frame struct {
	Version Version     `json:"version" yaml:"version"`
	Kind    Kind        `json:"kind" yaml:"kind"`
	Name    string      `json:"name" yaml:"name"`
	Spec    interface{} `json:"spec" yaml:"spec"`
	Curl    string      `json:"curl" yaml:"curl,omitempty"`
}

type Frontend

type Frontend struct {
	PacketTypes                     []string                                 `json:"header,omitempty" yaml:"header,omitempty,flow"`
	Identfier                       string                                   `json:"identifier,omitempty" yaml:"identifier,omitempty"`
	Length                          uint32                                   `json:"length,omitempty" yaml:"length,omitempty"`
	Payload                         string                                   `json:"payload,omitempty" yaml:"payload,omitempty"`
	AuthenticationOk                pgproto3.AuthenticationOk                `json:"authentication_ok,omitempty" yaml:"authentication_ok,omitempty"`
	AuthenticationCleartextPassword pgproto3.AuthenticationCleartextPassword `json:"authentication_cleartext_password,omitempty" yaml:"authentication_cleartext_password,omitempty"`
	AuthenticationMD5Password       pgproto3.AuthenticationMD5Password       `json:"authentication_md5_password,omitempty" yaml:"authentication_md5_password,omitempty"`
	AuthenticationGSS               pgproto3.AuthenticationGSS               `json:"authentication_gss,omitempty" yaml:"authentication_gss,omitempty"`
	AuthenticationGSSContinue       pgproto3.AuthenticationGSSContinue       `json:"authentication_gss_continue,omitempty" yaml:"authentication_gss_continue,omitempty"`
	AuthenticationSASL              pgproto3.AuthenticationSASL              `json:"authentication_sasl,omitempty" yaml:"authentication_sasl,omitempty"`
	AuthenticationSASLContinue      pgproto3.AuthenticationSASLContinue      `json:"authentication_sasl_continue,omitempty" yaml:"authentication_sasl_continue,omitempty,flow"`
	AuthenticationSASLFinal         pgproto3.AuthenticationSASLFinal         `json:"authentication_sasl_final,omitempty" yaml:"authentication_sasl_final,omitempty,flow"`
	BackendKeyData                  pgproto3.BackendKeyData                  `json:"backend_key_data,omitempty" yaml:"backend_key_data,omitempty"`
	BindComplete                    pgproto3.BindComplete                    `yaml:"-"`
	BindCompletes                   []pgproto3.BindComplete                  `json:"bind_complete,omitempty" yaml:"bind_complete,omitempty"`
	CloseComplete                   pgproto3.CloseComplete                   `json:"close_complete,omitempty" yaml:"close_complete,omitempty"`
	CommandComplete                 pgproto3.CommandComplete                 `yaml:"-"`
	CommandCompletes                []pgproto3.CommandComplete               `json:"command_complete,omitempty" yaml:"command_complete,omitempty"`
	CopyBothResponse                pgproto3.CopyBothResponse                `json:"copy_both_response,omitempty" yaml:"copy_both_response,omitempty"`
	CopyData                        pgproto3.CopyData                        `json:"copy_data,omitempty" yaml:"copy_data,omitempty"`
	CopyInResponse                  pgproto3.CopyInResponse                  `json:"copy_in_response,omitempty" yaml:"copy_in_response,omitempty"`
	CopyOutResponse                 pgproto3.CopyOutResponse                 `json:"copy_out_response,omitempty" yaml:"copy_out_response,omitempty"`
	CopyDone                        pgproto3.CopyDone                        `json:"copy_done,omitempty" yaml:"copy_done,omitempty"`
	DataRow                         pgproto3.DataRow                         `yaml:"-"`
	DataRows                        []pgproto3.DataRow                       `json:"data_row,omitempty" yaml:"data_row,omitempty,flow"`
	EmptyQueryResponse              pgproto3.EmptyQueryResponse              `json:"empty_query_response,omitempty" yaml:"empty_query_response,omitempty"`
	ErrorResponse                   pgproto3.ErrorResponse                   `json:"error_response,omitempty" yaml:"error_response,omitempty"`
	FunctionCallResponse            pgproto3.FunctionCallResponse            `json:"function_call_response,omitempty" yaml:"function_call_response,omitempty"`
	NoData                          pgproto3.NoData                          `json:"no_data,omitempty" yaml:"no_data,omitempty"`
	NoticeResponse                  pgproto3.NoticeResponse                  `json:"notice_response,omitempty" yaml:"notice_response,omitempty"`
	NotificationResponse            pgproto3.NotificationResponse            `json:"notification_response,omitempty" yaml:"notification_response,omitempty"`
	ParameterDescription            pgproto3.ParameterDescription            `json:"parameter_description,omitempty" yaml:"parameter_description,omitempty"`
	ParameterStatus                 pgproto3.ParameterStatus                 `yaml:"-"`
	ParameterStatusCombined         []pgproto3.ParameterStatus               `json:"parameter_status,omitempty" yaml:"parameter_status,omitempty"`
	ParseComplete                   pgproto3.ParseComplete                   `yaml:"-"`
	ParseCompletes                  []pgproto3.ParseComplete                 `json:"parse_complete,omitempty" yaml:"parse_complete,omitempty"`
	ReadyForQuery                   pgproto3.ReadyForQuery                   `json:"ready_for_query,omitempty" yaml:"ready_for_query,omitempty"`
	RowDescription                  pgproto3.RowDescription                  `json:"row_description,omitempty" yaml:"row_description,omitempty,flow"`
	PortalSuspended                 pgproto3.PortalSuspended                 `json:"portal_suspended,omitempty" yaml:"portal_suspended,omitempty"`
	MsgType                         byte                                     `json:"msg_type,omitempty" yaml:"msg_type,omitempty"`
	AuthType                        int32                                    `json:"auth_type" yaml:"auth_type"`
	// AuthMechanism                   string                                   `json:"auth_mechanism,omitempty" yaml:"auth_mechanism,omitempty"`
	BodyLen int `json:"body_len,omitempty" yaml:"body_len,omitempty"`
}

type GenericPayload

type GenericPayload struct {
	Origin  OriginType     `json:"Origin,omitempty" yaml:"origin" bson:"origin,omitempty"`
	Message []OutputBinary `json:"Message,omitempty" yaml:"message" bson:"message,omitempty"`
}

type GenericSchema

type GenericSchema struct {
	Metadata         map[string]string `json:"metadata" yaml:"metadata"`
	GenericRequests  []GenericPayload  `json:"RequestBin,omitempty"`
	GenericResponses []GenericPayload  `json:"ResponseBin,omitempty"`
	ReqTimestampMock time.Time         `json:"reqTimestampMock,omitempty"`
	ResTimestampMock time.Time         `json:"resTimestampMock,omitempty"`
}

type GlobalNoise

type GlobalNoise map[string]map[string][]string

type Globalnoise

type Globalnoise struct {
	Global   GlobalNoise  `json:"global" yaml:"global"`
	Testsets TestsetNoise `json:"test-sets" yaml:"test-sets"`
}

type GrpcHeaders

type GrpcHeaders struct {
	PseudoHeaders   map[string]string `json:"pseudo_headers" yaml:"pseudo_headers"`
	OrdinaryHeaders map[string]string `json:"ordinary_headers" yaml:"ordinary_headers"`
}

type GrpcLengthPrefixedMessage

type GrpcLengthPrefixedMessage struct {
	CompressionFlag uint   `json:"compression_flag" yaml:"compression_flag"`
	MessageLength   uint32 `json:"message_length" yaml:"message_length"`
	DecodedData     string `json:"decoded_data" yaml:"decoded_data"`
}

type GrpcReq

type GrpcReq struct {
	Headers GrpcHeaders               `json:"headers" yaml:"headers"`
	Body    GrpcLengthPrefixedMessage `json:"body" yaml:"body"`
}

type GrpcResp

type GrpcResp struct {
	Headers  GrpcHeaders               `json:"headers" yaml:"headers"`
	Body     GrpcLengthPrefixedMessage `json:"body" yaml:"body"`
	Trailers GrpcHeaders               `json:"trailers" yaml:"trailers"`
}

type GrpcSpec

type GrpcSpec struct {
	GrpcReq          GrpcReq   `json:"grpcReq" yaml:"grpcReq"`
	GrpcResp         GrpcResp  `json:"grpcResp" yaml:"grpcResp"`
	ReqTimestampMock time.Time `json:"reqTimestampMock" yaml:"reqTimestampMock,omitempty"`
	ResTimestampMock time.Time `json:"resTimestampMock" yaml:"resTimestampMock,omitempty"`
}

type GrpcStream

type GrpcStream struct {
	StreamID uint32
	GrpcReq  GrpcReq
	GrpcResp GrpcResp
}

GrpcStream is a helper function to combine the request-response model in a single struct.

func NewGrpcStream

func NewGrpcStream(streamID uint32) GrpcStream

NewGrpcStream returns a GrpcStream with all the nested maps initialised.

type HTTPReq

type HTTPReq struct {
	Method     Method            `json:"method" yaml:"method"`
	ProtoMajor int               `json:"proto_major" yaml:"proto_major"` // e.g. 1
	ProtoMinor int               `json:"proto_minor" yaml:"proto_minor"` // e.g. 0
	URL        string            `json:"url" yaml:"url"`
	URLParams  map[string]string `json:"url_params" yaml:"url_params,omitempty"`
	Header     map[string]string `json:"header" yaml:"header"`
	Body       string            `json:"body" yaml:"body"`
	Binary     string            `json:"binary" yaml:"binary,omitempty"`
	Form       []FormData        `json:"form" yaml:"form,omitempty"`
	Timestamp  time.Time         `json:"timestamp" yaml:"timestamp"`
}

type HTTPResp

type HTTPResp struct {
	StatusCode    int               `json:"status_code" yaml:"status_code"` // e.g. 200
	Header        map[string]string `json:"header" yaml:"header"`
	Body          string            `json:"body" yaml:"body"`
	StatusMessage string            `json:"status_message" yaml:"status_message"`
	ProtoMajor    int               `json:"proto_major" yaml:"proto_major"`
	ProtoMinor    int               `json:"proto_minor" yaml:"proto_minor"`
	Binary        string            `json:"binary" yaml:"binary,omitempty"`
	Timestamp     time.Time         `json:"timestamp" yaml:"timestamp"`
}

type HTTPSchema

type HTTPSchema struct {
	Metadata         map[string]string      `json:"metadata" yaml:"metadata"`
	Request          HTTPReq                `json:"req" yaml:"req"`
	Response         HTTPResp               `json:"resp" yaml:"resp"`
	Objects          []*OutputBinary        `json:"objects" yaml:"objects"`
	Assertions       map[string]interface{} `json:"assertions" yaml:"assertions,omitempty"`
	Created          int64                  `json:"created" yaml:"created,omitempty"`
	ReqTimestampMock time.Time              `json:"reqTimestampMock" yaml:"reqTimestampMock,omitempty"`
	ResTimestampMock time.Time              `json:"resTimestampMock" yaml:"resTimestampMock,omitempty"`
}
type Header struct {
	Key   string   `json:"key" bson:"key" yaml:"key"`
	Value []string `json:"value" bson:"value" yaml:"value"`
}

type HeaderResult

type HeaderResult struct {
	Normal   bool   `json:"normal" bson:"normal" yaml:"normal"`
	Expected Header `json:"expected" bson:"expected" yaml:"expected"`
	Actual   Header `json:"actual" bson:"actual" yaml:"actual"`
}

type HookOptions

type HookOptions struct {
	Mode          Mode
	EnableTesting bool
}

type IncomingOptions

type IncomingOptions struct {
}

type IntResult

type IntResult struct {
	Normal   bool `json:"normal" bson:"normal" yaml:"normal"`
	Expected int  `json:"expected" bson:"expected" yaml:"expected"`
	Actual   int  `json:"actual" bson:"actual" yaml:"actual"`
}

type KctxType

type KctxType string

type Kind

type Kind string

type Method

type Method string

type Mock

type Mock struct {
	Version      Version      `json:"Version,omitempty" bson:"Version,omitempty"`
	Name         string       `json:"Name,omitempty" bson:"Name,omitempty"`
	Kind         Kind         `json:"Kind,omitempty" bson:"Kind,omitempty"`
	Spec         MockSpec     `json:"Spec,omitempty" bson:"Spec,omitempty"`
	TestModeInfo TestModeInfo `json:"TestModeInfo,omitempty"  bson:"TestModeInfo,omitempty"` // Map for additional test mode information
	ConnectionID string       `json:"ConnectionId,omitempty" bson:"ConnectionId,omitempty"`
}

func (*Mock) GetKind

func (m *Mock) GetKind() string

type MockSpec

type MockSpec struct {
	Metadata          map[string]string `` /* 139-byte string literal not displayed */
	GenericRequests   []GenericPayload  `json:"RequestBin,omitempty" bson:"generic_requests,omitempty"`
	GenericResponses  []GenericPayload  `json:"ResponseBin,omitempty" bson:"generic_responses,omitempty"`
	HTTPReq           *HTTPReq          `json:"Req,omitempty" bson:"http_req,omitempty"`
	HTTPResp          *HTTPResp         `json:"Res,omitempty" bson:"http_resp,omitempty"`
	Created           int64             `json:"Created,omitempty" bson:"created,omitempty"`
	MongoRequests     []MongoRequest    `json:"MongoRequests,omitempty" bson:"mongo_requests,omitempty"`
	MongoResponses    []MongoResponse   `json:"MongoResponses,omitempty" bson:"mongo_responses,omitempty"`
	PostgresRequests  []Backend         `json:"postgresRequests,omitempty" bson:"postgres_requests,omitempty"`
	PostgresResponses []Frontend        `json:"postgresResponses,omitempty" bson:"postgres_responses,omitempty"`
	GRPCReq           *GrpcReq          `json:"gRPCRequest,omitempty" bson:"grpc_req,omitempty"`
	GRPCResp          *GrpcResp         `json:"grpcResponse,omitempty" bson:"grpc_resp,omitempty"`
	MySQLRequests     []MySQLRequest    `json:"MySqlRequests,omitempty" bson:"my_sql_requests,omitempty"`
	MySQLResponses    []MySQLResponse   `json:"MySqlResponses,omitempty" bson:"my_sql_responses,omitempty"`
	ReqTimestampMock  time.Time         `json:"ReqTimestampMock,omitempty" bson:"req_timestamp_mock,omitempty"`
	ResTimestampMock  time.Time         `json:"ResTimestampMock,omitempty" bson:"res_timestamp_mock,omitempty"`
}

type Mode

type Mode string

Mode represents the mode at which the SDK is operating MODE_RECORD is for recording API calls to generate testcases MODE_TEST is for testing the application on previous recorded testcases MODE_OFF disables keploy SDK automatically from the application

func GetMode

func GetMode() Mode

GetMode returns the mode of the keploy SDK

func (Mode) Valid

func (m Mode) Valid() bool

Valid checks if the provided mode is valid

type ModeKey

type ModeKey uint32
const (
	RecordKey ModeKey = 0
	TestKey   ModeKey = 1
)

These are the keys used to send the keploy record and test ports and pids to the ebpf program when testbench is enabled

type MongoHeader

type MongoHeader struct {
	Length     int32              `json:"length" yaml:"length" bson:"length"`
	RequestID  int32              `json:"requestId" yaml:"requestId" bson:"request_id"`
	ResponseTo int32              `json:"responseTo" yaml:"responseTo" bson:"response_to"`
	Opcode     wiremessage.OpCode `json:"Opcode" yaml:"Opcode" bson:"opcode"`
}

type MongoOpMessage

type MongoOpMessage struct {
	FlagBits int      `json:"flagBits" yaml:"flagBits" bson:"flagBits"`
	Sections []string `json:"sections" yaml:"sections" bson:"sections"`
	Checksum int      `json:"checksum" yaml:"checksum" bson:"checksum"`
}

type MongoOpQuery

type MongoOpQuery struct {
	Flags                int32  `json:"flags" yaml:"flags" bson:"flags"`
	FullCollectionName   string `json:"collection_name" yaml:"collection_name" bson:"collection_name"`
	NumberToSkip         int32  `json:"number_to_skip" yaml:"number_to_skip" bson:"number_to_skip"`
	NumberToReturn       int32  `json:"number_to_return" yaml:"number_to_return" bson:"number_to_return"`
	Query                string `json:"query" yaml:"query" bson:"query"`
	ReturnFieldsSelector string `json:"return_fields_selector" yaml:"return_fields_selector" bson:"return_fields_selector"`
}

type MongoOpReply

type MongoOpReply struct {
	ResponseFlags  int32    `json:"response_flags" yaml:"response_flags" bson:"response_flags"`
	CursorID       int64    `json:"cursor_id" yaml:"cursor_id" bson:"cursor_id"`
	StartingFrom   int32    `json:"starting_from" yaml:"starting_from" bson:"starting_from"`
	NumberReturned int32    `json:"number_returned" yaml:"number_returned" bson:"number_returned"`
	Documents      []string `json:"documents" yaml:"documents" bson:"documents"`
}

type MongoRequest

type MongoRequest struct {
	Header    *MongoHeader `json:"header,omitempty" yaml:"header,omitempty" bson:"header,omitempty"`
	Message   interface{}  `json:"message,omitempty" yaml:"message,omitempty" bson:"message,omitempty"`
	ReadDelay int64        `json:"read_delay,omitempty" yaml:"read_delay,omitempty" bson:"read_delay,omitempty"`
}

func (*MongoRequest) MarshalJSON

func (mr *MongoRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler for mongoRequests because of interface typeof field

func (*MongoRequest) UnmarshalBSON

func (mr *MongoRequest) UnmarshalBSON(data []byte) error

UnmarshalBSON implements bson.Unmarshaler for mongoRequests because of interface typeof field

func (*MongoRequest) UnmarshalJSON

func (mr *MongoRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler for mongoRequests because of interface typeof field

type MongoResponse

type MongoResponse struct {
	Header    *MongoHeader `json:"header,omitempty" yaml:"header,omitempty" bson:"header,omitempty"`
	Message   interface{}  `json:"message,omitempty" yaml:"message,omitempty" bson:"message,omitempty"`
	ReadDelay int64        `json:"read_delay,omitempty" yaml:"read_delay,omitempty" bson:"read_delay,omitempty"`
}

func (*MongoResponse) MarshalJSON

func (mr *MongoResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler for mongoResponses because of interface typeof field

func (*MongoResponse) UnmarshalBSON

func (mr *MongoResponse) UnmarshalBSON(data []byte) error

UnmarshalBSON implements bson.Unmarshaler for mongoResponses because of interface typeof field

func (*MongoResponse) UnmarshalJSON

func (mr *MongoResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler for mongoResponses because of interface typeof field

type MongoSpec

type MongoSpec struct {
	Metadata         map[string]string `json:"metadata" yaml:"metadata"`
	Requests         []RequestYaml     `json:"requests" yaml:"requests"`
	Response         []ResponseYaml    `json:"responses" yaml:"responses"`
	CreatedAt        int64             `json:"created" yaml:"created,omitempty"`
	ReqTimestampMock time.Time         `json:"reqTimestampMock" yaml:"reqTimestampMock,omitempty"`
	ResTimestampMock time.Time         `json:"resTimestampMock" yaml:"resTimestampMock,omitempty"`
}

type MySQLComChangeUserPacket

type MySQLComChangeUserPacket struct {
	User         string `json:"user,omitempty" yaml:"user,omitempty,flow" bson:"user,omitempty"`
	Auth         string `json:"auth,omitempty" yaml:"auth,omitempty,flow" bson:"auth,omitempty"`
	Db           string `json:"db,omitempty" yaml:"db,omitempty,flow" bson:"db,omitempty"`
	CharacterSet uint8  `json:"character_set,omitempty" yaml:"character_set,omitempty,flow" bson:"character_set,omitempty"`
	AuthPlugin   string `json:"auth_plugin,omitempty" yaml:"auth_plugin,omitempty,flow" bson:"auth_plugin,omitempty"`
}

type MySQLComStmtClosePacket

type MySQLComStmtClosePacket struct {
	StatementID uint32 `json:"statement_id,omitempty" yaml:"statement_id,omitempty,flow" bson:"statement_id,omitempty"`
}

type MySQLComStmtExecute

type MySQLComStmtExecute struct {
	StatementID    uint32           `json:"statement_id,omitempty" yaml:"statement_id,omitempty,flow" bson:"statement_id,omitempty"`
	Flags          byte             `json:"flags,omitempty" yaml:"flags,omitempty,flow" bson:"flags,omitempty"`
	IterationCount uint32           `json:"iteration_count,omitempty" yaml:"iteration_count,omitempty,flow" bson:"iteration_count,omitempty"`
	NullBitmap     string           `json:"null_bitmap,omitempty" yaml:"null_bitmap,omitempty,flow" bson:"null_bitmap,omitempty"`
	ParamCount     uint16           `json:"param_count,omitempty" yaml:"param_count,omitempty,flow" bson:"param_count,omitempty"`
	Parameters     []BoundParameter `json:"parameters,omitempty" yaml:"parameters,omitempty,flow" bson:"parameters,omitempty"`
}

type MySQLComStmtFetchPacket

type MySQLComStmtFetchPacket struct {
	StatementID uint32 `json:"statement_id,omitempty" yaml:"statement_id,omitempty,flow" bson:"statement_id,omitempty"`
	RowCount    uint32 `json:"row_count,omitempty" yaml:"row_count,omitempty,flow" bson:"row_count,omitempty"`
	Info        string `json:"info,omitempty" yaml:"info,omitempty,flow" bson:"info,omitempty"`
}

type MySQLComStmtPreparePacket

type MySQLComStmtPreparePacket struct {
	Query string `json:"query,omitempty" yaml:"query,omitempty,flow" bson:"query,omitempty"`
}

type MySQLComStmtSendLongData

type MySQLComStmtSendLongData struct {
	StatementID uint32 `json:"statement_id,omitempty" yaml:"statement_id,omitempty,flow" bson:"statement_id,omitempty"`
	ParameterID uint16 `json:"parameter_id,omitempty" yaml:"parameter_id,omitempty,flow" bson:"parameter_id,omitempty"`
	Data        string `json:"data,omitempty" yaml:"data,omitempty,flow" bson:"data,omitempty"`
}

type MySQLERRPacket

type MySQLERRPacket struct {
	Header         byte   `json:"header,omitempty" yaml:"header,omitempty,flow" bson:"header,omitempty"`
	ErrorCode      uint16 `json:"error_code,omitempty" yaml:"error_code,omitempty,flow" bson:"error_code,omitempty"`
	SQLStateMarker string `json:"sql_state_marker,omitempty" yaml:"sql_state_marker,omitempty,flow" bson:"sql_state_marker,omitempty"`
	SQLState       string `json:"sql_state,omitempty" yaml:"sql_state,omitempty,flow" bson:"sql_state,omitempty"`
	ErrorMessage   string `json:"error_message,omitempty" yaml:"error_message,omitempty,flow" bson:"error_message,omitempty"`
}

type MySQLHandshakeResponse

type MySQLHandshakeResponse struct {
	CapabilityFlags uint32 `json:"capability_flags,omitempty" yaml:"capability_flags,omitempty,flow" bson:"capability_flags,omitempty"`
	MaxPacketSize   uint32 `json:"max_packet_size,omitempty" yaml:"max_packet_size,omitempty,flow" bson:"max_packet_size,omitempty"`
	CharacterSet    uint8  `json:"character_set,omitempty" yaml:"character_set,omitempty,flow" bson:"character_set,omitempty"`
	Reserved        int    `json:"reserved,omitempty" yaml:"reserved,omitempty,flow" bson:"reserved,omitempty"`
	Username        string `json:"username,omitempty" yaml:"username,omitempty,flow" bson:"username,omitempty"`
	AuthData        string `json:"auth_data,omitempty" yaml:"auth_data,omitempty,flow" bson:"auth_data,omitempty"`
	Database        string `json:"database,omitempty" yaml:"database,omitempty,flow" bson:"database,omitempty"`
	AuthPluginName  string `json:"auth_plugin_name,omitempty" yaml:"auth_plugin_name,omitempty,flow" bson:"auth_plugin_name,omitempty"`
}

type MySQLHandshakeResponseOk

type MySQLHandshakeResponseOk struct {
	PacketIndicator string        `json:"packet_indicator,omitempty" yaml:"packet_indicator,omitempty,flow" bson:"packet_indicator,omitempty"`
	PluginDetails   PluginDetails `json:"plugin_details,omitempty" yaml:"plugin_details,omitempty,flow" bson:"plugin_details,omitempty"`
	RemainingBytes  string        `json:"remaining_bytes,omitempty" yaml:"remaining_bytes,omitempty,flow" bson:"remaining_bytes,omitempty"`
}

type MySQLHandshakeV10Packet

type MySQLHandshakeV10Packet struct {
	ProtocolVersion uint8  `json:"protocol_version,omitempty" yaml:"protocol_version,omitempty,flow" bson:"protocol_version,omitempty"`
	ServerVersion   string `json:"server_version,omitempty" yaml:"server_version,omitempty,flow" bson:"server_version,omitempty"`
	ConnectionID    uint32 `json:"connection_id,omitempty" yaml:"connection_id,omitempty,flow" bson:"connection_id,omitempty"`
	AuthPluginData  string `json:"auth_plugin_data,omitempty" yaml:"auth_plugin_data,omitempty,flow" bson:"auth_plugin_data,omitempty"`
	CapabilityFlags uint32 `json:"capability_flags,omitempty" yaml:"capability_flags,omitempty,flow" bson:"capability_flags,omitempty"`
	CharacterSet    uint8  `json:"character_set,omitempty" yaml:"character_set,omitempty,flow" bson:"character_set,omitempty"`
	StatusFlags     uint16 `json:"status_flags,omitempty" yaml:"status_flags,omitempty,flow" bson:"status_flags,omitempty"`
	AuthPluginName  string `json:"auth_plugin_name,omitempty" yaml:"auth_plugin_name,omitempty,flow" bson:"auth_plugin_name,omitempty"`
}

type MySQLOKPacket

type MySQLOKPacket struct {
	AffectedRows uint64 `json:"affected_rows,omitempty" yaml:"affected_rows,omitempty,flow" bson:"affected_rows,omitempty"`
	LastInsertID uint64 `json:"last_insert_id,omitempty" yaml:"last_insert_id,omitempty,flow" bson:"last_insert_id,omitempty"`
	StatusFlags  uint16 `json:"status_flags,omitempty" yaml:"status_flags,omitempty,flow" bson:"status_flags,omitempty"`
	Warnings     uint16 `json:"warnings,omitempty" yaml:"warnings,omitempty,flow" bson:"warnings,omitempty"`
	Info         string `json:"info,omitempty" yaml:"info,omitempty,flow" bson:"info,omitempty"`
}

type MySQLPacketHeader

type MySQLPacketHeader struct {
	PacketLength uint32 `json:"packet_length,omitempty" yaml:"packet_length,omitempty,flow" bson:"packet_length,omitempty"`
	PacketNumber uint8  `json:"packet_number,omitempty" yaml:"packet_number,omitempty,flow" bson:"packet_number,omitempty"`
	PacketType   string `json:"packet_type,omitempty" yaml:"packet_type,omitempty,flow" bson:"packet_type,omitempty"`
}

type MySQLQueryPacket

type MySQLQueryPacket struct {
	Command byte   `json:"command,omitempty" yaml:"command,omitempty,flow" bson:"command,omitempty"`
	Query   string `json:"query,omitempty" yaml:"query,omitempty,flow" bson:"query,omitempty"`
}

type MySQLRequest

type MySQLRequest struct {
	Header    *MySQLPacketHeader `json:"header,omitempty" yaml:"header,omitempty,flow" bson:"header,omitempty"`
	Message   interface{}        `json:"message,omitempty" yaml:"message,omitempty,flow" bson:"message,omitempty"`
	ReadDelay int64              `json:"read_delay,omitempty" yaml:"read_delay,omitempty,flow" bson:"read_delay,omitempty"`
}

type MySQLResponse

type MySQLResponse struct {
	Header    *MySQLPacketHeader `json:"header,omitempty" yaml:"header,omitempty,flow" bson:"header,omitempty"`
	Message   interface{}        `json:"message,omitempty" yaml:"message,omitempty,flow" bson:"message,omitempty"`
	ReadDelay int64              `json:"read_delay,omitempty" yaml:"read_delay,omitempty,flow" bson:"read_delay,omitempty"`
}

type MySQLResultSet

type MySQLResultSet struct {
	Columns             []*ColumnDefinition `json:"columns,omitempty" yaml:"columns,omitempty,flow" bson:"columns,omitempty"`
	Rows                []*Row              `json:"rows,omitempty" yaml:"rows,omitempty,flow" bson:"rows,omitempty"`
	EOFPresent          bool                `json:"eofPresent,omitempty" yaml:"eofPresent,omitempty,flow" bson:"eofPresent,omitempty"`
	PaddingPresent      bool                `json:"paddingPresent,omitempty" yaml:"paddingPresent,omitempty,flow" bson:"paddingPresent,omitempty"`
	EOFPresentFinal     bool                `json:"eofPresentFinal,omitempty" yaml:"eofPresentFinal,omitempty,flow" bson:"eofPresentFinal,omitempty"`
	PaddingPresentFinal bool                `json:"paddingPresentFinal,omitempty" yaml:"paddingPresentFinal,omitempty,flow" bson:"paddingPresentFinal,omitempty"`
	OptionalPadding     bool                `json:"optionalPadding,omitempty" yaml:"optionalPadding,omitempty,flow" bson:"optionalPadding,omitempty"`
	OptionalEOFBytes    string              `json:"optionalEOFBytes,omitempty" yaml:"optionalEOFBytes,omitempty,flow" bson:"optionalEOFBytes,omitempty"`
	EOFAfterColumns     string              `json:"eofAfterColumns,omitempty" yaml:"eofAfterColumns,omitempty,flow" bson:"eofAfterColumns,omitempty"`
}

type MySQLSpec

type MySQLSpec struct {
	Metadata  map[string]string   `json:"metadata" yaml:"metadata"`
	Requests  []MysqlRequestYaml  `json:"requests" yaml:"requests"`
	Response  []MysqlResponseYaml `json:"responses" yaml:"responses"`
	CreatedAt int64               `json:"created" yaml:"created,omitempty"`
}

type MySQLStmtPrepareOk

type MySQLStmtPrepareOk struct {
	Status       byte               `json:"status,omitempty" yaml:"status,omitempty,flow" bson:"status,omitempty"`
	StatementID  uint32             `json:"statement_id,omitempty" yaml:"statement_id,omitempty,flow" bson:"statement_id,omitempty"`
	NumColumns   uint16             `json:"num_columns,omitempty" yaml:"num_columns,omitempty,flow" bson:"num_columns,omitempty"`
	NumParams    uint16             `json:"num_params,omitempty" yaml:"num_params,omitempty,flow" bson:"num_params,omitempty"`
	WarningCount uint16             `json:"warning_count,omitempty" yaml:"warning_count,omitempty,flow" bson:"warning_count,omitempty"`
	ColumnDefs   []ColumnDefinition `json:"column_definitions,omitempty" yaml:"column_definitions,omitempty,flow" bson:"column_definitions,omitempty"`
	ParamDefs    []ColumnDefinition `json:"param_definitions,omitempty" yaml:"param_definitions,omitempty,flow" bson:"param_definitions,omitempty"`
}

type MySQLcomStmtReset

type MySQLcomStmtReset struct {
	StatementID uint32 `json:"statement_id,omitempty" yaml:"statement_id,omitempty,flow" bson:"statement_id,omitempty"`
}

type MysqlRequestYaml

type MysqlRequestYaml struct {
	Header    *MySQLPacketHeader `json:"header,omitempty" yaml:"header"`
	Message   yaml.Node          `json:"message,omitempty" yaml:"message"`
	ReadDelay int64              `json:"read_delay,omitempty" yaml:"read_delay,omitempty"`
}

type MysqlResponseYaml

type MysqlResponseYaml struct {
	Header    *MySQLPacketHeader `json:"header,omitempty" yaml:"header"`
	Message   yaml.Node          `json:"message,omitempty" yaml:"message"`
	ReadDelay int64              `json:"read_delay,omitempty" yaml:"read_delay,omitempty"`
}

type Noise

type Noise map[string][]string

type OriginType

type OriginType string
const (
	FromServer OriginType = "server"
	FromClient OriginType = "client"
)

constant for mock origin

type OutgoingOptions

type OutgoingOptions struct {
	Rules         []config.BypassRule
	MongoPassword string
	// TODO: role of SQLDelay should be mentioned in the comments.
	SQLDelay       time.Duration // This is the same as Application delay.
	FallBackOnMiss bool          // this enables to pass the request to the actual server if no mock is found during test mode.
}

type OutputBinary

type OutputBinary struct {
	Type string `json:"type" bson:"type" yaml:"type"`
	Data string `json:"data" bson:"data" yaml:"data"`
}

OutputBinary store the encoded binary output of the egress calls as base64-encoded strings

type PacketHeader

type PacketHeader struct {
	PacketLength     uint32 `json:"packet_length,omitempty" yaml:"packet_length,omitempty,flow" bson:"packet_length,omitempty"`
	PacketSequenceID uint8  `json:"packet_sequence_id,omitempty" yaml:"packet_sequence_id,omitempty,flow" bson:"packet_sequence_id,omitempty"`
}

type Params

type Params struct {
	Key   string `json:"key" bson:"key" yaml:"key"`
	Value string `json:"value" bson:"value" yaml:"value"`
}

type PluginDetails

type PluginDetails struct {
	Type    string `json:"type,omitempty" yaml:"type,omitempty,flow" bson:"type,omitempty"`
	Message string `json:"message,omitempty" yaml:"message,omitempty,flow" bson:"message,omitempty"`
}

type PostgresSpec

type PostgresSpec struct {
	Metadata map[string]string `json:"metadata" yaml:"metadata"`

	// Objects  []*models.OutputBinary          `json:"objects" yaml:"objects"`
	PostgresRequests  []Backend  `json:"RequestBin,omitempty"`
	PostgresResponses []Frontend `json:"ResponseBin,omitempty"`

	ReqTimestampMock time.Time `json:"ReqTimestampMock,omitempty"`
	ResTimestampMock time.Time `json:"ResTimestampMock,omitempty"`
}

type Record

type Record struct {
	Path          string        `json:"path" yaml:"path"`
	Command       string        `json:"command" yaml:"command"`
	ProxyPort     uint32        `json:"proxyport" yaml:"proxyport"`
	ContainerName string        `json:"containerName" yaml:"containerName"`
	NetworkName   string        `json:"networkName" yaml:"networkName"`
	Delay         uint64        `json:"delay" yaml:"delay"`
	BuildDelay    time.Duration `json:"buildDelay" yaml:"buildDelay"`
	Tests         TestFilter    `json:"tests" yaml:"tests"`
	Stubs         Stubs         `json:"stubs" yaml:"stubs"`
}

type RegularPacket

type RegularPacket struct {
	Identifier byte
	Length     uint32
	Payload    []byte
}

type ReqCompare

type ReqCompare struct {
	MethodResult    StringResult      `json:"method_result" bson:"method_result" yaml:"method_result"`
	URLResult       StringResult      `json:"url_result" bson:"url_result" yaml:"url_result"`
	URLParamsResult []URLParamsResult `json:"url_params_result" bson:"url_params_result" yaml:"url_params_result"`
	ProtoMajor      IntResult         `json:"proto_major" bson:"proto_major" yaml:"proto_major"`
	ProtoMinor      IntResult         `json:"proto_minor" bson:"proto_minor" yaml:"proto_minor"`
	HeaderResult    []HeaderResult    `json:"headers_result" bson:"headers_result" yaml:"headers_result"`
	BodyResult      BodyResult        `json:"body_result" bson:"body_result" yaml:"body_result"`
}

type RequestYaml

type RequestYaml struct {
	Header    *MongoHeader `json:"header,omitempty" yaml:"header"`
	Message   yaml.Node    `json:"message,omitempty" yaml:"message"`
	ReadDelay int64        `json:"read_delay,omitempty" yaml:"read_delay,omitempty"`
}

type RespCompare

type RespCompare struct {
	StatusCode    IntResult      `json:"status_code" bson:"status_code" yaml:"status_code"`
	HeadersResult []HeaderResult `json:"headers_result" bson:"headers_result" yaml:"headers_result"`
	BodyResult    BodyResult     `json:"body_result" bson:"body_result" yaml:"body_result"`
}

type ResponseYaml

type ResponseYaml struct {
	Header    *MongoHeader `json:"header,omitempty" yaml:"header"`
	Message   yaml.Node    `json:"message,omitempty" yaml:"message"`
	ReadDelay int64        `json:"read_delay,omitempty" yaml:"read_delay,omitempty"`
}

type Result

type Result struct {
	StatusCode    IntResult      `json:"status_code" bson:"status_code" yaml:"status_code"`
	HeadersResult []HeaderResult `json:"headers_result" bson:"headers_result" yaml:"headers_result"`
	BodyResult    []BodyResult   `json:"body_result" bson:"body_result" yaml:"body_result"`
	DepResult     []DepResult    `json:"dep_result" bson:"dep_result" yaml:"dep_result"`
}

type Row

type Row struct {
	Header  RowHeader             `json:"header,omitempty" yaml:"header,omitempty,flow" bson:"header,omitempty"`
	Columns []RowColumnDefinition `json:"columns,omitempty" yaml:"columns,omitempty,flow" bson:"columns,omitempty"`
}

type RowColumnDefinition

type RowColumnDefinition struct {
	Type  FieldType   `json:"type,omitempty" yaml:"type,omitempty,flow" bson:"type,omitempty"`
	Name  string      `json:"name,omitempty" yaml:"name,omitempty,flow" bson:"name,omitempty"`
	Value interface{} `json:"value,omitempty" yaml:"value,omitempty,flow" bson:"value,omitempty"`
}

type RowHeader

type RowHeader struct {
	PacketLength     uint8 `json:"packet_length,omitempty" yaml:"packet_length,omitempty,flow" bson:"packet_length,omitempty"`
	PacketSequenceID uint8 `json:"packet_sequence_id,omitempty" yaml:"packet_sequence_id,omitempty,flow" bson:"packet_sequence_id,omitempty"`
}

type RunOptions

type RunOptions struct {
}

type SetupOptions

type SetupOptions struct {
	Container     string
	DockerNetwork string
	DockerDelay   time.Duration
}

type Spec

type Spec struct {
}

type StartupPacket

type StartupPacket struct {
	Length          uint32
	ProtocolVersion uint32
}

type StringResult

type StringResult struct {
	Normal   bool   `json:"normal" bson:"normal" yaml:"normal"`
	Expected string `json:"expected" bson:"expected" yaml:"expected"`
	Actual   string `json:"actual" bson:"actual" yaml:"actual"`
}

type Stubs

type Stubs struct {
	Filters []Filters `json:"filters" yaml:"filters"`
}

type TeleEvent

type TeleEvent struct {
	InstallationID string                 `json:"installationId"`
	EventType      string                 `json:"eventType"`
	Meta           map[string]interface{} `json:"meta"`
	CreatedAt      int64                  `json:"createdAt"`
	TeleCheck      bool                   `json:"tele_check"`
	OS             string                 `json:"os"`
	KeployVersion  string                 `json:"keploy_version"`
	Arch           string                 `json:"arch"`
}

type Test

type Test struct {
	Path                    string              `json:"path" yaml:"path"`
	Command                 string              `json:"command" yaml:"command"`
	ProxyPort               uint32              `json:"proxyport" yaml:"proxyport"`
	ContainerName           string              `json:"containerName" yaml:"containerName"`
	NetworkName             string              `json:"networkName" yaml:"networkName"`
	SelectedTests           map[string][]string `json:"selectedTests" yaml:"selectedTests"`
	GlobalNoise             Globalnoise         `json:"globalNoise" yaml:"globalNoise"`
	Delay                   uint64              `json:"delay" yaml:"delay"`
	BuildDelay              time.Duration       `json:"buildDelay" yaml:"buildDelay"`
	APITimeout              uint64              `json:"apiTimeout" yaml:"apiTimeout"`
	PassThroughPorts        []uint              `json:"passThroughPorts" yaml:"passThroughPorts"`
	BypassEndpointsRegistry []string            `json:"bypassEndpointsRegistry" yaml:"bypassEndpointsRegistry"`
	WithCoverage            bool                `json:"withCoverage" yaml:"withCoverage"`             // boolean to capture the coverage in test
	CoverageReportPath      string              `json:"coverageReportPath" yaml:"coverageReportPath"` // directory path to store the coverage files
	IgnoreOrdering          bool                `json:"ignoreOrdering" yaml:"ignoreOrdering"`
	Stubs                   Stubs               `json:"stubs" yaml:"stubs"`
}

type TestCase

type TestCase struct {
	Version  Version             `json:"version" bson:"version"`
	Kind     Kind                `json:"kind" bson:"kind"`
	Name     string              `json:"name" bson:"name"`
	Created  int64               `json:"created" bson:"created"`
	Updated  int64               `json:"updated" bson:"updated"`
	Captured int64               `json:"captured" bson:"captured"`
	HTTPReq  HTTPReq             `json:"http_req" bson:"http_req"`
	HTTPResp HTTPResp            `json:"http_resp" bson:"http_resp"`
	AllKeys  map[string][]string `json:"all_keys" bson:"all_keys"`
	GrpcResp GrpcResp            `json:"grpcResp" bson:"grpcResp"`
	GrpcReq  GrpcReq             `json:"grpcReq" bson:"grpcReq"`
	Anchors  map[string][]string `json:"anchors" bson:"anchors"`
	Noise    map[string][]string `json:"noise" bson:"noise"`
	Mocks    []*Mock             `json:"mocks" bson:"mocks"`
	Type     string              `json:"type" bson:"type"`
	Curl     string              `json:"curl" bson:"curl"`
}

func (*TestCase) GetKind

func (tc *TestCase) GetKind() string

type TestFilter

type TestFilter struct {
	Filters []Filters `json:"filters" yaml:"filters"`
}

func (*TestFilter) GetKind

func (tests *TestFilter) GetKind() string

type TestModeInfo

type TestModeInfo struct {
	ID         int  `json:"Id,omitempty" bson:"Id,omitempty"`
	IsFiltered bool `json:"isFiltered,omitempty" bson:"isFiltered,omitempty"`
	SortOrder  int  `json:"sortOrder,omitempty" bson:"SortOrder,omitempty"`
}

type TestReport

type TestReport struct {
	Version Version      `json:"version" yaml:"version"`
	Name    string       `json:"name" yaml:"name"`
	Status  string       `json:"status" yaml:"status"`
	Success int          `json:"success" yaml:"success"`
	Failure int          `json:"failure" yaml:"failure"`
	Total   int          `json:"total" yaml:"total"`
	Tests   []TestResult `json:"tests" yaml:"tests,omitempty"`
	TestSet string       `json:"testSet" yaml:"test_set"`
}

func (*TestReport) GetKind

func (tr *TestReport) GetKind() string

type TestResult

type TestResult struct {
	Kind         Kind       `json:"kind" yaml:"kind"`
	Name         string     `json:"name" yaml:"name"`
	Status       TestStatus `json:"status" yaml:"status"`
	Started      int64      `json:"started" yaml:"started"`
	Completed    int64      `json:"completed" yaml:"completed"`
	TestCasePath string     `json:"testCasePath" yaml:"test_case_path"`
	MockPath     string     `json:"mockPath" yaml:"mock_path"`
	TestCaseID   string     `json:"testCaseID" yaml:"test_case_id"`
	Req          HTTPReq    `json:"req" yaml:"req,omitempty"`
	Res          HTTPResp   `json:"resp" yaml:"resp,omitempty"`
	Noise        Noise      `json:"noise" yaml:"noise,omitempty"`
	Result       Result     `json:"result" yaml:"result"`
}

func (*TestResult) GetKind

func (tr *TestResult) GetKind() string

type TestSetStatus

type TestSetStatus string
const (
	TestSetStatusRunning      TestSetStatus = "RUNNING"
	TestSetStatusFailed       TestSetStatus = "FAILED"
	TestSetStatusPassed       TestSetStatus = "PASSED"
	TestSetStatusAppHalted    TestSetStatus = "APP_HALTED"
	TestSetStatusUserAbort    TestSetStatus = "USER_ABORT"
	TestSetStatusFaultUserApp TestSetStatus = "APP_FAULT"
	TestSetStatusInternalErr  TestSetStatus = "INTERNAL_ERR"
)

constants for testSet status

func StringToTestSetStatus

func StringToTestSetStatus(s string) (TestSetStatus, error)

type TestStatus

type TestStatus string
const (
	TestStatusPending TestStatus = "PENDING"
	TestStatusRunning TestStatus = "RUNNING"
	TestStatusFailed  TestStatus = "FAILED"
	TestStatusPassed  TestStatus = "PASSED"
)

constants for test status

type TestingOptions

type TestingOptions struct {
	Mode Mode
}

type TestsetNoise

type TestsetNoise map[string]map[string]map[string][]string

type URLParamsResult

type URLParamsResult struct {
	Normal   bool   `json:"normal" bson:"normal" yaml:"normal"`
	Expected Params `json:"expected" bson:"expected" yaml:"expected"`
	Actual   Params `json:"actual" bson:"actual" yaml:"actual"`
}

type Version

type Version string

func GetVersion

func GetVersion() (V1 Version)

Jump to

Keyboard shortcuts

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