Documentation
¶
Overview ¶
Package microvm provides deterministic test doubles for AppTheory MicroVM controllers.
Index ¶
- type Call
- type FakeClient
- func (c *FakeClient) Calls() []Call
- func (c *FakeClient) Create(_ context.Context, input runtimemicrovm.CreateSessionInput) (runtimemicrovm.SessionRecord, error)
- func (c *FakeClient) Session(_ context.Context, input runtimemicrovm.SessionQueryInput) (runtimemicrovm.SessionRecord, error)
- func (c *FakeClient) SetNow(now time.Time)
- func (c *FakeClient) Start(_ context.Context, input runtimemicrovm.SessionCommandInput) (runtimemicrovm.SessionRecord, error)
- func (c *FakeClient) Status(_ context.Context, input runtimemicrovm.SessionQueryInput) (runtimemicrovm.SessionStatus, error)
- func (c *FakeClient) Stop(_ context.Context, input runtimemicrovm.SessionCommandInput) (runtimemicrovm.SessionRecord, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Call ¶
type Call struct {
Command runtimemicrovm.Command
RequestID string
TenantID string
Namespace string
SessionID string
}
Call records one fake client operation.
type FakeClient ¶
type FakeClient struct {
// contains filtered or unexported fields
}
FakeClient is an in-memory constrained MicroVM client for tests.
func NewFakeClient ¶
func NewFakeClient() *FakeClient
NewFakeClient creates a fake client with a deterministic starting clock.
func NewFakeClientWithTime ¶
func NewFakeClientWithTime(now time.Time) *FakeClient
NewFakeClientWithTime creates a fake client with the provided current time.
func (*FakeClient) Calls ¶
func (c *FakeClient) Calls() []Call
Calls returns a copy of recorded calls.
func (*FakeClient) Create ¶
func (c *FakeClient) Create(_ context.Context, input runtimemicrovm.CreateSessionInput) (runtimemicrovm.SessionRecord, error)
Create creates a fake session record.
func (*FakeClient) Session ¶
func (c *FakeClient) Session(_ context.Context, input runtimemicrovm.SessionQueryInput) (runtimemicrovm.SessionRecord, error)
Session returns a fake session record.
func (*FakeClient) SetNow ¶
func (c *FakeClient) SetNow(now time.Time)
SetNow sets the fake client's current time.
func (*FakeClient) Start ¶
func (c *FakeClient) Start(_ context.Context, input runtimemicrovm.SessionCommandInput) (runtimemicrovm.SessionRecord, error)
Start marks a fake session as starting toward started.
func (*FakeClient) Status ¶
func (c *FakeClient) Status(_ context.Context, input runtimemicrovm.SessionQueryInput) (runtimemicrovm.SessionStatus, error)
Status returns fake session status.
func (*FakeClient) Stop ¶
func (c *FakeClient) Stop(_ context.Context, input runtimemicrovm.SessionCommandInput) (runtimemicrovm.SessionRecord, error)
Stop marks a fake session as stopping toward stopped.