Documentation
¶
Index ¶
- func Assert(t TestInfo, message string, actual interface{}, ...)
- func AssertNoPush(ctx context.Context, t TestInfo, m manipulate.Manipulator, ...) func() func() error
- func AssertPush(ctx context.Context, t TestInfo, m manipulate.Manipulator, ...) func() func() error
- func AssertPushOptionAdditionalFilter(filter func(event *elemental.Event) bool) func(cfg *assertPushConfig)
- func AssertPushOptionEventAsserter(...) func(cfg *assertPushConfig)
- func AssertPushOptionNegativeTimeout(timeout time.Duration) func(cfg *assertPushConfig)
- func AssertPushOptionPositiveTimeout(timeout time.Duration) func(cfg *assertPushConfig)
- func AssertPushOptionSubscriberOptions(options ...maniphttp.SubscriberOption) func(cfg *assertPushConfig)
- func CreateNamespace(ctx context.Context, m manipulate.Manipulator, name string, ...) (*gaia.Namespace, manipulate.Context, error)
- func ListenForPushEvent(ctx context.Context, m manipulate.Manipulator, ...) error
- func NewCommand(name string, description string, version string) *cobra.Command
- func RegisterTest(t Test)
- func Step(t TestInfo, name string, step func() error)
- type AssertPushOption
- type Cleanup
- func CreateAccount(ctx context.Context, m manipulate.Manipulator, account *gaia.Account, ...) (manipulate.Manipulator, *gaia.Account, Cleanup, error)
- func CreateNamespaces(ctx context.Context, m manipulate.Manipulator, rootNamespace string, ...) (c Cleanup, err error)
- func CreateTestAccount(ctx context.Context, m manipulate.Manipulator, t TestInfo) (manipulate.Manipulator, *gaia.Account, Cleanup, error)
- func CreateTestNamespace(ctx context.Context, m manipulate.Manipulator, t TestInfo) (string, Cleanup, error)
- type SetupFunction
- type SetupSuiteFunction
- type Suite
- type SuiteInfo
- type TearDownFunction
- type Test
- type TestFunction
- type TestInfo
- func (t TestInfo) Account(password string) *gaia.Account
- func (t TestInfo) AccountName() string
- func (t TestInfo) AccountNamespace() string
- func (t TestInfo) Iteration() int
- func (t TestInfo) PrivateAPI() string
- func (t TestInfo) PrivateTLSConfig() *tls.Config
- func (t TestInfo) PublicAPI() string
- func (t TestInfo) PublicManipulator() manipulate.Manipulator
- func (t TestInfo) PublicTLSConfig() *tls.Config
- func (t TestInfo) RootManipulator() manipulate.Manipulator
- func (t TestInfo) SetupInfo() interface{}
- func (t TestInfo) SuiteSetupInfo() interface{}
- func (t TestInfo) TestID() string
- func (t TestInfo) TestNamespace(iteration int) string
- func (t TestInfo) TimeSinceLastStep() string
- func (t TestInfo) Timeout() time.Duration
- func (t TestInfo) Write(p []byte) (n int, err error)
- func (t TestInfo) WriteHeader(p []byte) (n int, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Assert ¶
func Assert(t TestInfo, message string, actual interface{}, f func(interface{}, ...interface{}) string, expected ...interface{})
Assert can use goconvey function to perform an assertion.
func AssertNoPush ¶
func AssertNoPush( ctx context.Context, t TestInfo, m manipulate.Manipulator, identity elemental.Identity, eventType elemental.EventType, options ...AssertPushOption, ) func() func() error
AssertNoPush asserts a push is not received.
func AssertPush ¶
func AssertPush( ctx context.Context, t TestInfo, m manipulate.Manipulator, identity elemental.Identity, eventType elemental.EventType, options ...AssertPushOption, ) func() func() error
AssertPush asserts a push is correctly received.
func AssertPushOptionAdditionalFilter ¶
func AssertPushOptionAdditionalFilter(filter func(event *elemental.Event) bool) func(cfg *assertPushConfig)
AssertPushOptionAdditionalFilter sets an additional filter to basic elemental.Identity and elemental.EventType matching. If it returns false, the push assertion function continues to wait.
func AssertPushOptionEventAsserter ¶
func AssertPushOptionEventAsserter(asserter func(event *elemental.Event, identifiable elemental.Identifiable) error) func(cfg *assertPushConfig)
AssertPushOptionEventAsserter sets the function to run to validate the event and its content after the filter matches.
func AssertPushOptionNegativeTimeout ¶
AssertPushOptionNegativeTimeout sets the time to wait for a push assertion that should not find a push. Default is 3s.
func AssertPushOptionPositiveTimeout ¶
AssertPushOptionPositiveTimeout sets the time to wait for a push assertion that should find a push.Default is 10s.
func AssertPushOptionSubscriberOptions ¶
func AssertPushOptionSubscriberOptions(options ...maniphttp.SubscriberOption) func(cfg *assertPushConfig)
AssertPushOptionSubscriberOptions passes additional maniphttp.SuscriberOptions to the underlying maniphttp.Subscriber.
func CreateNamespace ¶
func CreateNamespace(ctx context.Context, m manipulate.Manipulator, name string, mctx manipulate.Context) (*gaia.Namespace, manipulate.Context, error)
CreateNamespace creates the namespace with the given name in the given namespace. It returns the created namespace, a manipulate.Context pointing to the namespace and an eventual error.
func ListenForPushEvent ¶
func ListenForPushEvent(ctx context.Context, m manipulate.Manipulator, verifier func(*elemental.Event) bool, evtCh chan *elemental.Event, options ...maniphttp.SubscriberOption) error
ListenForPushEvent listen for a event
func NewCommand ¶
NewCommand generates a new CLI for regolith
Types ¶
type AssertPushOption ¶
type AssertPushOption func(*assertPushConfig)
An AssertPushOption represents options to push assertion functions.
type Cleanup ¶
type Cleanup func() error
Cleanup function is a type function.
func CreateAccount ¶
func CreateAccount(ctx context.Context, m manipulate.Manipulator, account *gaia.Account, t TestInfo) (manipulate.Manipulator, *gaia.Account, Cleanup, error)
CreateAccount creates the given gaia.Account and returns a manipulator for this account.
func CreateNamespaces ¶
func CreateNamespaces(ctx context.Context, m manipulate.Manipulator, rootNamespace string, nss string) (c Cleanup, err error)
CreateNamespaces creates the desired namespace line.
func CreateTestAccount ¶
func CreateTestAccount(ctx context.Context, m manipulate.Manipulator, t TestInfo) (manipulate.Manipulator, *gaia.Account, Cleanup, error)
CreateTestAccount creates an account using the given TestInfo and returns an authenticated manipulator.
func CreateTestNamespace ¶
func CreateTestNamespace(ctx context.Context, m manipulate.Manipulator, t TestInfo) (string, Cleanup, error)
CreateTestNamespace a namespace using the given TestInfo.
type SetupFunction ¶
type SetupFunction func(context.Context, TestInfo) (interface{}, TearDownFunction, error)
SetupFunction is the type of function that can be run a a test setup. The returned data will be available to the main test function using TestInfo.SetupInfo() function. The returned function will be run at the end of the test.
If SetupFunction returns an error, the entire suite of test is stopped.
type SetupSuiteFunction ¶
type SetupSuiteFunction func(context.Context, SuiteInfo) (interface{}, TearDownFunction, error)
SetupSuiteFunction is the type of function that can be run from a suite setup. The returned data will be available to the main test function using TestInfo.SuiteSetupInfo() function. The returned function will be run at the end of the suite.
If SetupSuiteFunction returns an error, the entire suite of test is stopped.
type Suite ¶
type Suite struct { Name string Description string Setup SetupSuiteFunction }
Suite is a collection of tests
type SuiteInfo ¶
type SuiteInfo interface { RegisterTest(t Test) // SetupInfo provides the user data SetupInfo() interface{} // Write performs a write Write(p []byte) (n int, err error) }
SuiteInfo is the interface for the test writer
type TearDownFunction ¶
type TearDownFunction func()
A TearDownFunction is the type of function returned by a SetupFunction.
type Test ¶
type Test struct { Name string Description string Author string Tags []string Setup SetupFunction Function TestFunction SuiteName string // contains filtered or unexported fields }
A Test represents an actual test.
type TestFunction ¶
A TestFunction is the type of a function that is run by a Test.
type TestInfo ¶
type TestInfo struct {
// contains filtered or unexported fields
}
A TestInfo contains various information about a test.
func (TestInfo) AccountName ¶
AccountName returns a unique account name that can be used by this test.
func (TestInfo) AccountNamespace ¶
AccountNamespace returns the account namespace that can be used by this test.
func (TestInfo) PrivateAPI ¶
PrivateAPI returns the private API endpoint.
func (TestInfo) PrivateTLSConfig ¶
PrivateTLSConfig returns the public TLS config.
func (TestInfo) PublicManipulator ¶
func (t TestInfo) PublicManipulator() manipulate.Manipulator
PublicManipulator returns the public manipulator if any.
func (TestInfo) PublicTLSConfig ¶
PublicTLSConfig returns the public TLS config.
func (TestInfo) RootManipulator ¶
func (t TestInfo) RootManipulator() manipulate.Manipulator
RootManipulator returns the root manipulator if any.
func (TestInfo) SetupInfo ¶
func (t TestInfo) SetupInfo() interface{}
SetupInfo returns the eventual object stored by the Setup function.
func (TestInfo) SuiteSetupInfo ¶
func (t TestInfo) SuiteSetupInfo() interface{}
SuiteSetupInfo returns the eventual object stored by the Suite Setup function.
func (TestInfo) TestNamespace ¶
TestNamespace returns a unique namespace that can be used by this test.
func (TestInfo) TimeSinceLastStep ¶
TimeSinceLastStep provides the time since last step or assertion