Documentation ¶
Overview ¶
Package cockroachdb includes CockroachDB implementation of Gnomock Preset interface. This Preset can be passed to gnomock.Start() function to create a configured CockroachDB container to use in tests.
Containers created with this preset use `root` user without a password for authentication. There is currently no way to setup an initial user at create time.
By default, a new database "mydb" is created, and all the provided queries are executed against it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Option ¶
type Option func(*P)
Option is an optional configuration of this Gnomock preset. Use available Options to configure the container.
func WithDatabase ¶
WithDatabase creates a database with the provided name in the container. WithQueries, if provided, runs against the new database.
func WithQueries ¶
WithQueries executes the provided queries against the database created with WithDatabase, or against the default database.
func WithQueriesFile ¶
WithQueriesFile sets a file name to read initial queries from. Queries from this file are executed before any other queries provided in WithQueries.
type P ¶
type P struct { Version string `json:"version"` DB string `json:"db"` Queries []string `json:"queries"` QueriesFiles []string `json:"queries_files"` }
P is a Gnomock Preset implementation for CockroachDB.
func (*P) Ports ¶
func (p *P) Ports() gnomock.NamedPorts
Ports returns ports that should be used to access this container.