utils

package
v0.0.0-...-05bc493 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2023 License: MIT Imports: 65 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertCallDelegationTokenEqual

func AssertCallDelegationTokenEqual(t TestingT, expected, actual *rms.CallDelegationToken, msgAndArgs ...interface{}) bool

func AssertNotJumpToStep

func AssertNotJumpToStep(t *testing.T, j *journal.Journal, stepName string)

func AssertVCallRequestEqual

func AssertVCallRequestEqual(t TestingT, expected, actual *rms.VCallRequest, msgAndArgs ...interface{}) bool

func AssertVStateReport_ProvidedContentBodyEqual

func AssertVStateReport_ProvidedContentBodyEqual(t TestingT, expected, actual *rms.VStateReport_ProvidedContentBody, msgAndArgs ...interface{}) bool

func AssertVStateReportsEqual

func AssertVStateReportsEqual(t TestingT, expected, actual *rms.VStateReport, msgAndArgs ...interface{}) bool

func GenerateVCallRequestMethod

func GenerateVCallRequestMethod(server *Server) *rms.VCallRequest

GenerateVCallRequestMethod returns CallTypeMethod VCallRequest for tolerable/dirty request by default

func GenerateVCallRequestMethodImmutable

func GenerateVCallRequestMethodImmutable(server *Server) *rms.VCallRequest

func InterceptLog

func InterceptLog(logger log.Logger, interceptFn LogInterceptHandler) log.Logger

func MakeMinimumValidVStateResult

func MakeMinimumValidVStateResult(server *Server, returnArgs []byte) *rms.VCallResult

Types

type ConveyorCycleFunc

type ConveyorCycleFunc func(c *conveyor.PulseConveyor, hasActive, isIdle bool)

type LogInterceptHandler

type LogInterceptHandler = func(interface{})

type RequestWrapper

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

func NewRequestWrapper

func NewRequestWrapper(pulseNumber pulse.Number, payload rmsreg.GoGoSerializable) *RequestWrapper

func (*RequestWrapper) Finalize

func (w *RequestWrapper) Finalize() *message.Message

func (*RequestWrapper) SetReceiver

func (w *RequestWrapper) SetReceiver(receiver reference.Global) *RequestWrapper

func (*RequestWrapper) SetSender

func (w *RequestWrapper) SetSender(sender reference.Global) *RequestWrapper

type Server

type Server struct {
	Runner *runner.DefaultService

	// testing components and Mocks
	PublisherMock      *publisher.Mock
	JetCoordinatorMock *affinity.HelperMock

	Journal *journal.Journal
	// contains filtered or unexported fields
}

func NewServer

func NewServer(ctx context.Context, t Tester) (*Server, context.Context)

func NewServerWithErrorFilter

func NewServerWithErrorFilter(ctx context.Context, t Tester, errorFilterFn logcommon.ErrorFilterFunc) (*Server, context.Context)

func NewUninitializedServer

func NewUninitializedServer(ctx context.Context, t Tester) (*Server, context.Context)

func NewUninitializedServerWithErrorFilter

func NewUninitializedServerWithErrorFilter(ctx context.Context, t Tester, errorFilterFn logcommon.ErrorFilterFunc) (*Server, context.Context)

func (*Server) AddInput

func (s *Server) AddInput(ctx context.Context, msg interface{}) error

func (*Server) BuildRandomOutgoingWithGivenPulse

func (s *Server) BuildRandomOutgoingWithGivenPulse(pn pulse.Number) reference.Global

func (*Server) BuildRandomOutgoingWithPrevPulse

func (s *Server) BuildRandomOutgoingWithPrevPulse() reference.Global

func (*Server) BuildRandomOutgoingWithPulse

func (s *Server) BuildRandomOutgoingWithPulse() reference.Global

func (*Server) CallAPIAddAmount

func (s *Server) CallAPIAddAmount(ctx context.Context, wallet reference.Global, amount uint) (int, []byte)

nolint:interfacer

func (*Server) CallAPICreateWallet

func (s *Server) CallAPICreateWallet(ctx context.Context) (int, []byte)

Utility function RE wallet + HTTP API

func (*Server) CallAPIDelete

func (s *Server) CallAPIDelete(ctx context.Context, wallet reference.Global) (int, []byte)

nolint:interfacer

func (*Server) CallAPIGetBalance

func (s *Server) CallAPIGetBalance(ctx context.Context, wallet reference.Global) (int, []byte)

nolint:interfacer

func (*Server) CallAPITransfer

func (s *Server) CallAPITransfer(ctx context.Context, walletFrom reference.Global, walletTo reference.Global, amount uint) (int, []byte)

nolint:interfacer

func (*Server) DelegationToken

func (s *Server) DelegationToken(outgoing reference.Global, to reference.Global, object reference.Global) rms.CallDelegationToken

func (*Server) GetPrevPulse

func (s *Server) GetPrevPulse() beat.Beat

func (*Server) GetPrevPulseNumber

func (s *Server) GetPrevPulseNumber() pulse.Number

func (*Server) GetPulse

func (s *Server) GetPulse() beat.Beat

func (*Server) GetPulseNumber

func (s *Server) GetPulseNumber() pulse.Number

func (*Server) GetPulseTime

func (s *Server) GetPulseTime() time.Duration

func (*Server) GlobalCaller

func (s *Server) GlobalCaller() reference.Global

func (*Server) IncrementPulse

func (s *Server) IncrementPulse(context.Context)

func (*Server) IncrementPulseAndWaitIdle

func (s *Server) IncrementPulseAndWaitIdle(ctx context.Context)

func (*Server) Init

func (s *Server) Init(ctx context.Context)

func (*Server) OverrideConveyorFactoryLogContext

func (s *Server) OverrideConveyorFactoryLogContext(ctx context.Context)

func (*Server) RandomGlobalWithPrevPulse

func (s *Server) RandomGlobalWithPrevPulse() reference.Global

func (*Server) RandomGlobalWithPulse

func (s *Server) RandomGlobalWithPulse() reference.Global

func (*Server) RandomLocalWithPrevPulse

func (s *Server) RandomLocalWithPrevPulse() reference.Local

func (*Server) RandomLocalWithPulse

func (s *Server) RandomLocalWithPulse() reference.Local

func (*Server) RandomRecordOf

func (s *Server) RandomRecordOf(obj reference.Global) reference.Global

func (*Server) RandomRecordOfWithGivenPulse

func (s *Server) RandomRecordOfWithGivenPulse(obj reference.Global, pn pulse.Number) reference.Global

func (*Server) ReplaceAuthenticationService

func (s *Server) ReplaceAuthenticationService(svc authentication.Service)

func (*Server) ReplaceCache

func (s *Server) ReplaceCache(cache descriptor.Cache)

func (*Server) ReplaceMachinesManager

func (s *Server) ReplaceMachinesManager(manager machine.Manager)

func (*Server) ReplaceRunner

func (s *Server) ReplaceRunner(svc runner.Service)

func (*Server) ResetActiveConveyorFlag

func (s *Server) ResetActiveConveyorFlag()

func (*Server) ResumeConveyor

func (s *Server) ResumeConveyor()

func (*Server) SendMessage

func (s *Server) SendMessage(_ context.Context, msg *message.Message)

deprecated // use SendMsg

func (*Server) SendMsg

func (s *Server) SendMsg(msg beat.Message)

func (*Server) SendPayload

func (s *Server) SendPayload(ctx context.Context, pl rmsreg.GoGoSerializable)

func (*Server) SendPayloadAsFuture

func (s *Server) SendPayloadAsFuture(ctx context.Context, pl rmsreg.GoGoSerializable)

func (*Server) SetMaxParallelism

func (s *Server) SetMaxParallelism(count int)

Set limit for parallel runners. Function must be called before server.Init If this limit does not set it will be set by default (NumCPU() - 2)

func (*Server) StartRecording

func (s *Server) StartRecording()

func (*Server) StartRecordingExt

func (s *Server) StartRecordingExt(limit int, discardOnOverflow bool)

func (*Server) StateReportBuilder

func (s *Server) StateReportBuilder() *StateReportBuilder

func (*Server) Stop

func (s *Server) Stop()

func (*Server) SuspendConveyorAndWait

func (s *Server) SuspendConveyorAndWait()

func (*Server) SuspendConveyorAndWaitThenResetActive

func (s *Server) SuspendConveyorAndWaitThenResetActive()

func (*Server) SuspendConveyorNoWait

func (s *Server) SuspendConveyorNoWait()

func (*Server) WaitActiveThenIdleConveyor

func (s *Server) WaitActiveThenIdleConveyor()

func (*Server) WaitIdleConveyor

func (s *Server) WaitIdleConveyor()

func (*Server) WrapPayload

func (s *Server) WrapPayload(pl rmsreg.GoGoSerializable) *RequestWrapper

func (*Server) WrapPayloadAsFuture

func (s *Server) WrapPayloadAsFuture(pl rmsreg.GoGoSerializable) *RequestWrapper

type ServerOpts

type ServerOpts struct {
	ErrorFilter    logcommon.ErrorFilterFunc
	Initialization bool
	Delta          uint16
}

func NewDefaultServerOpts

func NewDefaultServerOpts() ServerOpts

type StateReportBuilder

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

func NewStateReportBuilder

func NewStateReportBuilder() *StateReportBuilder

func (*StateReportBuilder) Class

func (*StateReportBuilder) DirtyInactive

func (b *StateReportBuilder) DirtyInactive() *StateReportBuilder

func (*StateReportBuilder) DirtyMemory

func (b *StateReportBuilder) DirtyMemory(mem []byte) *StateReportBuilder

func (*StateReportBuilder) Empty

func (*StateReportBuilder) Inactive

func (b *StateReportBuilder) Inactive() *StateReportBuilder

func (*StateReportBuilder) Memory

func (b *StateReportBuilder) Memory(mem []byte) *StateReportBuilder

func (*StateReportBuilder) Missing

func (b *StateReportBuilder) Missing() *StateReportBuilder

func (*StateReportBuilder) NoValidated

func (b *StateReportBuilder) NoValidated() *StateReportBuilder

func (*StateReportBuilder) Object

func (*StateReportBuilder) OrderedPendings

func (b *StateReportBuilder) OrderedPendings(num int) *StateReportBuilder

func (*StateReportBuilder) PendingsPulse

func (b *StateReportBuilder) PendingsPulse(pn pulse.Number) *StateReportBuilder

func (*StateReportBuilder) Pulse

func (*StateReportBuilder) Ready

func (*StateReportBuilder) Report

func (b *StateReportBuilder) Report() rms.VStateReport

func (*StateReportBuilder) ReportPtr

func (b *StateReportBuilder) ReportPtr() *rms.VStateReport

func (*StateReportBuilder) StateRef

func (*StateReportBuilder) UnorderedPendings

func (b *StateReportBuilder) UnorderedPendings(num int) *StateReportBuilder

func (*StateReportBuilder) ValidatedMemory

func (b *StateReportBuilder) ValidatedMemory(mem []byte) *StateReportBuilder

type Suite

type Suite struct {
	Skipped    string
	Parallel   bool
	TestRailID string

	Cases []TestRunner
}

func (Suite) Run

func (suite Suite) Run(t *testing.T)

type TestCase

type TestCase struct {
	Name       string
	TestRailID string
	Skipped    string

	Minimock     *minimock.Controller
	Server       *Server
	Context      context.Context
	Runner       *logicless.ServiceMock
	TypedChecker *checker.Typed
	// contains filtered or unexported fields
}

func NewSkippedTestCase

func NewSkippedTestCase(name string, jiraLink string) *TestCase

func NewTestCase

func NewTestCase(name string) *TestCase

func (*TestCase) ResetTestRailID

func (c *TestCase) ResetTestRailID()

func (*TestCase) Run

func (c *TestCase) Run(t *testing.T, fn func(t *testing.T))

func (*TestCase) SetParallel

func (c *TestCase) SetParallel(parallel bool)

func (*TestCase) WithErrorFilter

func (c *TestCase) WithErrorFilter(fn func(string) bool) *TestCase

func (*TestCase) WithSkipped

func (c *TestCase) WithSkipped(skipped string) *TestCase

func (*TestCase) WithTestRailID

func (c *TestCase) WithTestRailID(id string) *TestCase

type TestRunner

type TestRunner interface {
	TestRun(t *testing.T)
	SetParallel(parallel bool)
	ResetTestRailID()
}

type Tester

type Tester interface {
	Helper()
	Log(...interface{})

	Fatal(args ...interface{})
	Fatalf(format string, args ...interface{})
	Error(...interface{})
	Errorf(format string, args ...interface{})
	FailNow()
}

type TestingT

type TestingT interface {
	Helper()
	Logf(format string, args ...interface{})
	assert.TestingT
}

type VCallRequestConstructorHandler

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

func GenerateVCallRequestConstructor

func GenerateVCallRequestConstructor(server *Server) VCallRequestConstructorHandler

func GenerateVCallRequestConstructorForPulse

func GenerateVCallRequestConstructorForPulse(server *Server, pn pulse.Number) VCallRequestConstructorHandler

func (VCallRequestConstructorHandler) Get

func (VCallRequestConstructorHandler) GetIncoming

func (VCallRequestConstructorHandler) GetObject

func (VCallRequestConstructorHandler) GetOutgoing

func (*VCallRequestConstructorHandler) SetArguments

func (h *VCallRequestConstructorHandler) SetArguments(args []byte)

func (*VCallRequestConstructorHandler) SetCallFlags

func (h *VCallRequestConstructorHandler) SetCallFlags(flags rms.CallFlags)

func (*VCallRequestConstructorHandler) SetCallFlagsFromMethodIsolation

func (h *VCallRequestConstructorHandler) SetCallFlagsFromMethodIsolation(mi contract.MethodIsolation)

func (*VCallRequestConstructorHandler) SetCallOutgoing

func (h *VCallRequestConstructorHandler) SetCallOutgoing(callOutgoing reference.Global)

deprecated

func (*VCallRequestConstructorHandler) SetCallSequence

func (h *VCallRequestConstructorHandler) SetCallSequence(sequence uint32)

func (*VCallRequestConstructorHandler) SetCaller

func (*VCallRequestConstructorHandler) SetClass

func (*VCallRequestConstructorHandler) SetMethod

func (h *VCallRequestConstructorHandler) SetMethod(method string)

type WalletAddAmountRequestBody

type WalletAddAmountRequestBody struct {
	To     string `json:"to"`
	Amount uint   `json:"amount"`
}

nolint:unused,deadcode

type WalletAddAmountResponse

type WalletAddAmountResponse struct {
	Err     string `json:"error"`
	TraceID string `json:"traceID"`
}

nolint:unused

func UnmarshalWalletAddAmountResponse

func UnmarshalWalletAddAmountResponse(resp []byte) (WalletAddAmountResponse, error)

type WalletCreateResponse

type WalletCreateResponse struct {
	Err     string `json:"error"`
	Ref     string `json:"reference"`
	TraceID string `json:"traceID"`
}

func UnmarshalWalletCreateResponse

func UnmarshalWalletCreateResponse(resp []byte) (WalletCreateResponse, error)

type WalletDeleteRequestBody

type WalletDeleteRequestBody struct {
	Ref string `json:"walletRef"`
}

nolint:unused,deadcode

type WalletDeleteResponse

type WalletDeleteResponse struct {
	Err     string `json:"error"`
	TraceID string `json:"traceID"`
}

nolint:unused,deadcode

func UnmarshalWalletDeleteResponse

func UnmarshalWalletDeleteResponse(resp []byte) (WalletDeleteResponse, error)

type WalletGetBalanceRequestBody

type WalletGetBalanceRequestBody struct {
	Ref string `json:"walletRef"`
}

nolint:unused,deadcode

type WalletGetBalanceResponse

type WalletGetBalanceResponse struct {
	Err     string `json:"error"`
	Amount  uint   `json:"amount"`
	TraceID string `json:"traceID"`
}

nolint:unused,deadcode

func UnmarshalWalletGetBalanceResponse

func UnmarshalWalletGetBalanceResponse(resp []byte) (WalletGetBalanceResponse, error)

type WalletTransferRequestBody

type WalletTransferRequestBody struct {
	To     string `json:"to"`
	From   string `json:"from"`
	Amount uint   `json:"amount"`
}

nolint:unused,deadcode

type WalletTransferResponse

type WalletTransferResponse struct {
	Err     string `json:"error"`
	TraceID string `json:"traceID"`
}

nolint:unused

func UnmarshalWalletTransferResponse

func UnmarshalWalletTransferResponse(resp []byte) (WalletTransferResponse, error)

Jump to

Keyboard shortcuts

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