Documentation ¶
Index ¶
- Variables
- func Bootstrap() test.Options
- func NewFxTestRunner() test.InternalRunner
- func NewTestConfigProvider(kvs map[string]interface{}) *testConfigProvider
- func TestBootstrapper(ctx context.Context) *bootstrap.Bootstrapper
- func WithBootstrapConfigFS(fs ...embed.FS) test.Options
- func WithConfigFS(fs ...embed.FS) test.Options
- func WithConfigFxProvider(fxProvides ...interface{}) test.Options
- func WithDI(diTargets ...interface{}) test.Options
- func WithDynamicProperties(valuers map[string]PropertyValuerFunc) test.Options
- func WithFxOptions(opts ...fx.Option) test.Options
- func WithFxPriorityOptions(opts ...fx.Option) test.Options
- func WithModules(modules ...*bootstrap.Module) test.Options
- func WithProperties(kvs ...string) test.Options
- func WithTimeout(timeout time.Duration) test.Options
- type PropertyValuerFunc
Constants ¶
This section is empty.
Variables ¶
var TestApplicationConfigFS embed.FS
var TestBootstrapConfigFS embed.FS
var TestDefaultConfigFS embed.FS
Functions ¶
func Bootstrap ¶
Bootstrap is an entrypoint test.Options that indicates all sub tests should be run within the scope of an slim version of bootstrap.App
func NewFxTestRunner ¶
func NewFxTestRunner() test.InternalRunner
NewFxTestRunner is internal use only, exported for cross-package reference
func NewTestConfigProvider ¶
func NewTestConfigProvider(kvs map[string]interface{}) *testConfigProvider
NewTestConfigProvider is for internal usage. Export for cross-package reference Use WithConfigFS, WithProperties, WithDynamicProperties instead
func TestBootstrapper ¶
func TestBootstrapper(ctx context.Context) *bootstrap.Bootstrapper
TestBootstrapper returns current *bootstrap.Bootstrapper of the test context
func WithBootstrapConfigFS ¶
WithBootstrapConfigFS provides per-test config capability. It register an embed.FS as bootstrap config, in which properties like "config.file.search-path" can be overridden. the given embed.FS should contains at least one yml file. see appconfig.FxEmbeddedBootstrapAdHoc
func WithConfigFS ¶
WithConfigFS provides per-test config capability. It register an embed.FS as application config, which could override any defaults. the given embed.FS should contains at least one yml file see appconfig.FxEmbeddedApplicationAdHoc
func WithConfigFxProvider ¶
WithConfigFxProvider provides per-test config capability. It takes a fx.Option (usually fx.Provide) that returns/create appconfig.Provider and registers it as ad-hoc test application config provider. Note: Use it with caution. This is an advanced use case which typically used by other utility packages.
func WithDI ¶
WithDI populate given di targets by using fx.Populate all targets need to be pointer to struct, otherwise the test fails See fx.Populate for more information
func WithDynamicProperties ¶
func WithDynamicProperties(valuers map[string]PropertyValuerFunc) test.Options
WithDynamicProperties provides per-test config capability. It registers ad-hoc test application properties
func WithFxOptions ¶
WithFxOptions register given fx.Option to test app as regular steps see bootstrap.Module
func WithFxPriorityOptions ¶
WithFxPriorityOptions register given fx.Option to test app as priority steps, before any other modules see bootstrap.Module
func WithModules ¶
WithModules register given modules to test app
func WithProperties ¶
WithProperties provides per-test config capability. It registers ad-hoc test application properties. Supported format of each Key-Value pair are:
- "dotted.properties=value"
- "dotted.properties: value"
- "dotted.properties.without.value" implies the value is "true"