keploy

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

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

Variables

View Source
var (
	MockId   = MockLib{/* contains filtered or unexported fields */}
	MockPath string
)

Functions

func PutMock

func PutMock(ctx context.Context, path string, mock *proto.Mock) bool

func SetGrpcClient

func SetGrpcClient(c GrpcClient)

avoids circular dependency between mock and keploy packages

func SetMode

func SetMode(m Mode) error

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

func SetPath

func SetPath(path string)

func SetTestMode

func SetTestMode()

SetTestMode sets the keploy SDK mode to MODE_TEST

Types

type Context

type Context struct {
	Mode       Mode
	TestID     string
	FileExport bool
	Deps       []models.Dependency
	Mock       []*proto.Mock
	Mu         *sync.Mutex
	Remove     []string
	Replace    map[string]string
}

func GetState

func GetState(ctx context.Context) (*Context, error)

GetState returns value of "KeployContext" key-value pair which is stored in the request context.

type GrpcClient

type GrpcClient proto.RegressionServiceClient

func GetGrpcClient

func GetGrpcClient() GrpcClient

type KctxType

type KctxType string

type MockLib

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

func (*MockLib) Load

func (m *MockLib) Load(name string)

func (*MockLib) Unique

func (m *MockLib) Unique(name string) bool

To avoid creating the duplicate mock yaml file

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 GetModeFromContext

func GetModeFromContext(ctx context.Context) Mode

GetModeFromContext returns the mode on which SDK is configured by accessing environment variable.

func (Mode) Valid

func (m Mode) Valid() bool

Valid checks if the provided mode is valid

Jump to

Keyboard shortcuts

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