record

package
v2.2.0-alpha21-rc9 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package record provides functionality for recording and managing test cases and mocks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config interface {
	Read(ctx context.Context, testSetID string) (*models.TestSet, error)
	Write(ctx context.Context, testSetID string, testSet *models.TestSet) error
}

type FrameChan

type FrameChan struct {
	Incoming <-chan *models.TestCase
	Outgoing <-chan *models.Mock
}

type Instrumentation

type Instrumentation interface {
	//Setup prepares the environment for the recording
	Setup(ctx context.Context, cmd string, opts models.SetupOptions) (uint64, error)
	//Hook will load hooks and start the proxy server.
	Hook(ctx context.Context, id uint64, opts models.HookOptions) error
	GetIncoming(ctx context.Context, id uint64, opts models.IncomingOptions) (<-chan *models.TestCase, error)
	GetOutgoing(ctx context.Context, id uint64, opts models.OutgoingOptions) (<-chan *models.Mock, error)
	// Run is blocking call and will execute until error
	Run(ctx context.Context, id uint64, opts models.RunOptions) models.AppError
	GetContainerIP(ctx context.Context, id uint64) (string, error)
}

type MockDB

type MockDB interface {
	InsertMock(ctx context.Context, mock *models.Mock, testSetID string) error
}

type Recorder

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

func (*Recorder) GetContainerIP

func (r *Recorder) GetContainerIP(ctx context.Context, id uint64) (string, error)

func (*Recorder) GetNextTestSetID

func (r *Recorder) GetNextTestSetID(ctx context.Context) (string, error)

func (*Recorder) GetTestAndMockChans

func (r *Recorder) GetTestAndMockChans(ctx context.Context, appID uint64) (FrameChan, error)

func (*Recorder) Instrument

func (r *Recorder) Instrument(ctx context.Context) (uint64, error)

func (*Recorder) RunApplication

func (r *Recorder) RunApplication(ctx context.Context, appID uint64, opts models.RunOptions) models.AppError

func (*Recorder) Start

func (r *Recorder) Start(ctx context.Context, reRecord bool) error

type Service

type Service interface {
	Start(ctx context.Context, reRecord bool) error
	GetContainerIP(ctx context.Context, id uint64) (string, error)
}

func New

func New(logger *zap.Logger, testDB TestDB, mockDB MockDB, telemetry Telemetry, instrumentation Instrumentation, config *config.Config) Service

type Telemetry

type Telemetry interface {
	RecordedTestSuite(testSet string, testsTotal int, mockTotal map[string]int)
	RecordedTestCaseMock(mockType string)
	RecordedMocks(mockTotal map[string]int)
	RecordedTestAndMocks()
}

type TestDB

type TestDB interface {
	GetAllTestSetIDs(ctx context.Context) ([]string, error)
	InsertTestCase(ctx context.Context, tc *models.TestCase, testSetID string) error
}

Jump to

Keyboard shortcuts

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