Documentation ¶
Index ¶
- func EncodeBodyProtobuf(body ProtobufEncodable) any
- func ReadBodyFile(bodyFile string) any
- func Run(t *testing.T, suite TestingSuite, extraOptions ...Option)
- type AppUnderTest
- type DbSubscriberAssertion
- type DbSubscriberFetcher
- type DbSubscriberTestCase
- type DdbSubscriberAssertion
- type DdbSubscriberFetcher
- type DdbSubscriberTestCase
- type HttpserverTestCase
- type KvStoreSubscriberAssertion
- type KvstoreSubscriberFetcher
- type KvstoreSubscriberTestCase
- type 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 WithHttpServerShares() Option
- func WithIpReadFromMemory(name string, records map[string]ipread.MemoryRecord) Option
- func WithLogLevel(level string) Option
- func WithLogRecording() Option
- func WithModule(name string, essentialModule 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 ProtobufEncodable
- 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 ¶
func EncodeBodyProtobuf ¶ added in v0.16.0
func EncodeBodyProtobuf(body ProtobufEncodable) any
func ReadBodyFile ¶ added in v0.16.0
Types ¶
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 Version int 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 Version int Input interface{} Assert DdbSubscriberAssertion }
type HttpserverTestCase ¶ added in v0.15.0
type HttpserverTestCase struct { Method string Url string Headers map[string]string // Body will be used as the request body. Supported request body data types is `string`, // `[]byte`, `struct`, `map`, `slice` and `io.Reader`. Body value can be pointer or non-pointer. // Automatic marshalling for JSON and XML content type, if it is `struct`, `map`, or `slice`. // // If you call EncodeBodyProtobuf on your body before assigning it to this field, it will instead be // encoded using protobuf. // // To send the contents of a file, you can use ReadBodyFile and assign the result to this field. The // test suite will read the file contents and send it as your request. 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 // AssertResultFile can be used to read the expected response body from a file, which will be used to check equality // with the actual response body. If the file name extension is .json, the equality check is done via assert.JSONEq. AssertResultFile string }
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{} Version int Assert KvStoreSubscriberAssertion }
type Option ¶
type Option func(s *suiteOptions)
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 WithHttpServerShares ¶ added in v0.15.0
func WithHttpServerShares() Option
func WithIpReadFromMemory ¶
func WithIpReadFromMemory(name string, records map[string]ipread.MemoryRecord) Option
func WithLogLevel ¶
func WithLogRecording ¶ added in v0.18.1
func WithLogRecording() Option
func WithModule ¶
func WithModule(name string, essentialModule 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 ProtobufEncodable ¶ added in v0.16.0
type StreamTestCase ¶
type StreamTestCase struct { Input map[string][]StreamTestCaseInput Output map[string][]StreamTestCaseOutput Assert func() error }
type StreamTestCaseInput ¶
type StreamTestCaseOutput ¶
type SubscriberTestCase ¶
type SubscriberTestCase interface { GetName() string GetModelId() mdl.ModelId GetInput() interface{} GetVersion() int }
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) FailIfError ¶ added in v0.20.0
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 TestingSuiteApiDefinitionsAware ¶
type TestingSuiteApiDefinitionsAware interface {
SetupApiDefinitions() httpserver.Definer
}
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.