Documentation ¶
Overview ¶
Package all contains a test rig for all services.
Index ¶
- Constants
- Variables
- func IntegrationMain(m *testing.M, db string)
- func ProvideDLQConfig() (*dlq.Config, error)
- func ProvideWatcher(target sinktest.TargetSchema, watchers types.Watchers) (types.Watcher, error)
- type Fixture
- func (f *Fixture) Applier(ctx context.Context, table ident.Table) func([]types.Mutation) error
- func (f *Fixture) CreateDLQTable(ctx context.Context) (ident.Table, error)
- func (f *Fixture) CreateTargetTable(ctx context.Context, schemaSpec string) (base.TableInfo[*types.TargetPool], error)
- func (f *Fixture) PeekStaged(ctx context.Context, tbl ident.Table, bounds hlc.Range) ([]types.Mutation, error)
- func (f *Fixture) ReadStagingQuery(ctx context.Context, q *types.StagingQuery) (*types.MultiBatch, error)
Constants ¶
const ( // IntegrationEnvName is an environment variable that enables // integration tests for some databases. We expect this to be of the // format "database-v123". IntegrationEnvName = "CDC_INTEGRATION" // KafkaName must be kept in alignment with the // .github/docker-compose.yml file and the integration matrix // variable in workflows/tests.yaml. KafkaName = "kafka" // MySQLName must be kept in alignment with the // .github/docker-compose.yml file and the integration matrix // variable in workflows/tests.yaml. MySQLName = "mysql" // PostgreSQLName must be kept in alignment with the // .github/docker-compose.yml file and the integration matrix // variable in workflows/tests.yaml. PostgreSQLName = "postgresql" )
Variables ¶
var TestSet = wire.NewSet( base.TestSet, staging.Set, target.Set, ProvideDLQConfig, ProvideWatcher, wire.Struct(new(Fixture), "*"), )
TestSet contains providers to create a self-contained Fixture.
Functions ¶
func IntegrationMain ¶
IntegrationMain runs the tests if the value of IntegrationEnvName equals the given string, or starts with the given string, followed by a hyphen. This method calls os.Exit() and therefore never returns.
func ProvideDLQConfig ¶
ProvideDLQConfig emits a default configuration.
func ProvideWatcher ¶
ProvideWatcher is called by Wire to construct a Watcher bound to the testing database.
Types ¶
type Fixture ¶
type Fixture struct { *base.Fixture ApplyAcceptor *apply.Acceptor Checkpoints *checkpoint.Checkpoints Configs *applycfg.Configs Diagnostics *diag.Diagnostics DLQConfig *dlq.Config DLQs types.DLQs Memo types.Memo Stagers types.Stagers VersionChecker *version.Checker Watchers types.Watchers Watcher types.Watcher // A watcher for TestDB. }
Fixture provides a complete set of database-backed services. One can be constructed by calling NewFixture or by incorporating TestSet into a Wire provider set.
func NewFixture ¶
NewFixture constructs a self-contained test fixture for all services in the target sub-packages.
func (*Fixture) Applier ¶
Applier returns a bound function that will apply mutations to the given table.
func (*Fixture) CreateDLQTable ¶
CreateDLQTable ensures that a DLQ table exists. The name of the table is returned so that tests may inspect it.
func (*Fixture) CreateTargetTable ¶
func (f *Fixture) CreateTargetTable( ctx context.Context, schemaSpec string, ) (base.TableInfo[*types.TargetPool], error)
CreateTargetTable creates a test table within the TargetPool and TargetSchema. If the table is successfully created, the schema watcher will be refreshed. The schemaSpec parameter must have exactly one %s substitution parameter for the database name and table name.
func (*Fixture) PeekStaged ¶
func (f *Fixture) PeekStaged( ctx context.Context, tbl ident.Table, bounds hlc.Range, ) ([]types.Mutation, error)
PeekStaged peeks at the data which has been staged for the target table between the given timestamps.
func (*Fixture) ReadStagingQuery ¶
func (f *Fixture) ReadStagingQuery( ctx context.Context, q *types.StagingQuery, ) (*types.MultiBatch, error)
ReadStagingQuery executes the staging query, returning the complete result set.