testutils

package
v1.0.0-beta.120 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EventuallyWithTf

func EventuallyWithTf(t *testing.T, fn func(c *assert.CollectT, saveErr func(err any)), wait time.Duration, interval time.Duration)

func GetRFC3339Time

func GetRFC3339Time(t *testing.T, timeString string) time.Time

func InitPostgresDB

func InitPostgresDB(t *testing.T) *entsql.Driver

func NewLogger

func NewLogger(t testing.TB) *slog.Logger

Types

type EntMigrator

type EntMigrator struct{}

EntMigrator is a migrator for pgtestdb.

func (*EntMigrator) Hash

func (m *EntMigrator) Hash() (string, error)

Hash returns the md5 hash of the schema file.

func (*EntMigrator) Migrate

func (m *EntMigrator) Migrate(
	ctx context.Context,
	db *sql.DB,
	templateConf pgtestdb.Config,
) error

Migrate shells out to the `atlas` CLI program to migrate the template database.

atlas schema apply --auto-approve --url $DB --to file://$schemaFilePath

func (*EntMigrator) Prepare

func (*EntMigrator) Prepare(
	_ context.Context,
	_ *sql.DB,
	_ pgtestdb.Config,
) error

Prepare is a no-op method.

func (*EntMigrator) Verify

func (*EntMigrator) Verify(
	_ context.Context,
	_ *sql.DB,
	_ pgtestdb.Config,
) error

Verify is a no-op method.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL