Documentation ¶
Index ¶
- func IntegrationTest(ctx context.Context, t *testing.T, integrationDeps ...IntegrationDependency) (context.Context, func())
- func Must[T any](object T, err error) T
- func PgDBFromContext(ctx context.Context, t *testing.T) *sqlx.DB
- func PgUrlFromContext(ctx context.Context, t *testing.T) string
- func SqliteDBFromContext(ctx context.Context, t *testing.T) *sqlx.DB
- func SqliteUrlFromContext(ctx context.Context, t *testing.T) string
- func TempDirFromContext(ctx context.Context, t *testing.T) string
- type IntegrationDependency
- type SqliteDBConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IntegrationTest ¶
func IntegrationTest(ctx context.Context, t *testing.T, integrationDeps ...IntegrationDependency) (context.Context, func())
IntegrationTest skips a test if the INTEGRATION_TEST env variable is not set while running go tests
func Must ¶
/ Must takes an object `T` and an `error`, usually the result of calling another method. / It and returns `T` if the error is `nil`, otherwise it panics with `err`. / This is useful to quickly unwrap fallible operations in tests without cluttering the code with lots of `if err != nil`
func PgUrlFromContext ¶
/ PgUrlFromContext returns the database URL for the teemporary SQLite database
func SqliteUrlFromContext ¶
/ SqliteUrlFromContext returns the database URL for the teemporary SQLite database
Types ¶
type IntegrationDependency ¶
func WithPgDB ¶
func WithPgDB() IntegrationDependency
/ WithPgDB creates a temporary Postgres database
func WithSqliteDB ¶
func WithSqliteDB(cfg SqliteDBConfig) IntegrationDependency
/ WithSqliteDB creates a temporary SQLite database
func WithTempDir ¶
func WithTempDir() IntegrationDependency
/ WithTempDir creates a tempdir using the std testing lib