Documentation ¶
Index ¶
- func Run(t *testing.T, suite TestingSuite, extraOptions ...Option)
- type ApiServerTestCase
- type AppUnderTest
- type DbSubscriberAssertion
- type DbSubscriberFetcher
- type DbSubscriberTestCase
- type DdbSubscriberAssertion
- type DdbSubscriberFetcher
- type DdbSubscriberTestCase
- type KvStoreSubscriberAssertion
- type KvstoreSubscriberFetcher
- type KvstoreSubscriberTestCase
- type Option
- func WithApiServerShares() Option
- func WithClockProvider(clk clock.Clock) Option
- func WithClockProviderAt(datetime string) Option
- func WithComponent(settings env.ComponentBaseSettingsAware) Option
- func WithConfigFile(file string) Option
- func WithConfigMap(settings map[string]interface{}) Option
- func WithConsumer(callback stream.ConsumerCallbackFactory) Option
- func WithContainerExpireAfter(expireAfter time.Duration) Option
- func WithDbRepoChangeHistory() Option
- func WithEnvSetup(setups ...func() error) Option
- func WithFixtureBuilderFactories(factories ...fixtures.FixtureBuilderFactory) Option
- func WithIpReadFromMemory(name string, records map[string]ipread.MemoryRecord) Option
- func WithLogLevel(level string) Option
- func WithModule(name string, module kernel.ModuleFactory) Option
- func WithModuleFactory(factory kernel.ModuleMultiFactory) Option
- func WithSharedEnvironment() Option
- func WithSubscribers(transformerFactoryMap mdlsub.TransformerMapTypeVersionFactories) Option
- func WithTestCaseRepeatCount(repeatCount int) Option
- func WithTestCaseWhitelist(testCases ...string) Option
- func WithoutAutoDetectedComponents(components ...string) Option
- type StreamTestCase
- type StreamTestCaseInput
- type StreamTestCaseOutput
- type SubscriberTestCase
- type Suite
- type TestingSuite
- type TestingSuiteApiDefinitionsAware
- type TestingSuiteApplicationAware
- type TestingSuiteSetupTestAware
- type TestingSuiteTearDownTestAware
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ApiServerTestCase ¶
type ApiServerTestCase struct { Method string Url string Headers map[string]string Body interface{} // ExpectedStatusCode describes the status code the last response is required to have. ExpectedStatusCode int // ExpectedRedirectsToFollow describes the number of redirects we want to follow. It is an error if less redirects // are performed. More redirects result in the last redirect being returned as the response instead (e.g., if it is // to some external site or with a protocol different from HTTP(S) like intent://) and do not result in an error. ExpectedRedirectsToFollow int // ExpectedResult defines the *type* the final response should be parsed into. You can then access the unmarshalled // response in response.Result(). ExpectedResult interface{} // ExpectedErr is compared with the error returned by the HTTP request. Only the error messages have to match. ExpectedErr error // Assert allows you to provide an assertion function that can be passed to validate certain post conditions (like // messages being written to the correct queues). // It also allows to check that the response carries the correct response body, redirects to the correct // // location, or has the correct headers set. You don't need to validate the response status here, this is already // // performed automatically. Assert func(response *resty.Response) error }
type AppUnderTest ¶
type AppUnderTest interface { Stop() WaitDone() }
type DbSubscriberAssertion ¶
type DbSubscriberAssertion func(t *testing.T, fetcher *DbSubscriberFetcher)
type DbSubscriberFetcher ¶
type DbSubscriberFetcher struct {
// contains filtered or unexported fields
}
func (DbSubscriberFetcher) ByPrimaryKey ¶
func (f DbSubscriberFetcher) ByPrimaryKey(key interface{}, model interface{})
type DbSubscriberTestCase ¶
type DbSubscriberTestCase struct { Name string ModelId string Input interface{} Assert DbSubscriberAssertion }
type DdbSubscriberAssertion ¶
type DdbSubscriberAssertion func(t *testing.T, fetcher *DdbSubscriberFetcher)
type DdbSubscriberFetcher ¶
type DdbSubscriberFetcher struct {
// contains filtered or unexported fields
}
func (DdbSubscriberFetcher) ByHash ¶
func (f DdbSubscriberFetcher) ByHash(hash interface{}, model interface{})
func (DdbSubscriberFetcher) ByHashAndRange ¶
func (f DdbSubscriberFetcher) ByHashAndRange(hash interface{}, rangeValue interface{}, model interface{})
type DdbSubscriberTestCase ¶
type DdbSubscriberTestCase struct { Name string SourceModelId string TargetModelId string Input interface{} Assert DdbSubscriberAssertion }
type KvStoreSubscriberAssertion ¶
type KvStoreSubscriberAssertion func(t *testing.T, fetcher *KvstoreSubscriberFetcher)
type KvstoreSubscriberFetcher ¶
type KvstoreSubscriberFetcher struct {
// contains filtered or unexported fields
}
func (KvstoreSubscriberFetcher) Get ¶
func (f KvstoreSubscriberFetcher) Get(key interface{}, model mdlsub.Model)
type KvstoreSubscriberTestCase ¶
type KvstoreSubscriberTestCase struct { Name string ModelId string Input interface{} Assert KvStoreSubscriberAssertion }
type Option ¶
type Option func(s *suiteOptions)
func WithApiServerShares ¶
func WithApiServerShares() Option
func WithClockProvider ¶
func WithClockProviderAt ¶
func WithComponent ¶
func WithComponent(settings env.ComponentBaseSettingsAware) Option
func WithConfigFile ¶
func WithConfigMap ¶
func WithConsumer ¶
func WithConsumer(callback stream.ConsumerCallbackFactory) Option
func WithDbRepoChangeHistory ¶
func WithDbRepoChangeHistory() Option
func WithEnvSetup ¶
func WithFixtureBuilderFactories ¶
func WithFixtureBuilderFactories(factories ...fixtures.FixtureBuilderFactory) Option
func WithIpReadFromMemory ¶
func WithIpReadFromMemory(name string, records map[string]ipread.MemoryRecord) Option
func WithLogLevel ¶
func WithModule ¶
func WithModule(name string, module kernel.ModuleFactory) Option
func WithModuleFactory ¶
func WithModuleFactory(factory kernel.ModuleMultiFactory) Option
func WithSharedEnvironment ¶
func WithSharedEnvironment() Option
func WithSubscribers ¶
func WithSubscribers(transformerFactoryMap mdlsub.TransformerMapTypeVersionFactories) Option
func WithTestCaseRepeatCount ¶
WithTestCaseRepeatCount repeats the whole test suite the given number of times. This can be useful if a problem doesn't happen on every run (e.g., because it is timing dependent).
func WithTestCaseWhitelist ¶
WithTestCaseWhitelist returns an option which only runs the tests contained in the given whitelist. A test not in the whitelist is skipped instead, allowing you to easily run a single test (e.g., for debugging).
type StreamTestCase ¶
type StreamTestCase struct { Input map[string][]StreamTestCaseInput Output map[string][]StreamTestCaseOutput Assert func() error }
type StreamTestCaseInput ¶
type StreamTestCaseInput struct { Attributes map[string]interface{} Body interface{} }
type StreamTestCaseOutput ¶
type StreamTestCaseOutput struct { Model interface{} ExpectedAttributes map[string]interface{} ExpectedBody interface{} }
type SubscriberTestCase ¶
type SubscriberTestCase interface { GetName() string GetModelId() mdl.ModelId GetInput() interface{} }
func DbTestCase ¶
func DbTestCase(testCase DbSubscriberTestCase) (SubscriberTestCase, error)
func DdbTestCase ¶
func DdbTestCase(testCase DdbSubscriberTestCase) (SubscriberTestCase, error)
func KvstoreTestCase ¶
func KvstoreTestCase(testCase KvstoreSubscriberTestCase) (SubscriberTestCase, error)
type Suite ¶
type Suite struct { *assert.Assertions // contains filtered or unexported fields }
func (*Suite) Env ¶
func (s *Suite) Env() *env.Environment
func (*Suite) SetEnv ¶
func (s *Suite) SetEnv(env *env.Environment)
type TestingSuite ¶
type TestingSuite interface { Env() *env.Environment SetEnv(environment *env.Environment) SetT(t *testing.T) T() *testing.T SetupSuite() []Option }
type TestingSuiteApplicationAware ¶
type TestingSuiteApplicationAware interface {
SetupApplication() error
}
type TestingSuiteSetupTestAware ¶
type TestingSuiteSetupTestAware interface {
SetupTest() error
}
type TestingSuiteTearDownTestAware ¶
type TestingSuiteTearDownTestAware interface {
TearDownTest() error
}
Click to show internal directories.
Click to hide internal directories.