Documentation
¶
Overview ¶
Package testhelpers provides shared fixtures for integration tests.
Index ¶
- type MemoryStorage
- func (s *MemoryStorage) Copy(_ context.Context, src, dst string) error
- func (s *MemoryStorage) Get(_ context.Context, key string) (io.ReadCloser, string, error)
- func (s *MemoryStorage) GetRange(_ context.Context, key string, offset, length int64) (io.ReadCloser, error)
- func (s *MemoryStorage) Put(_ context.Context, key string, r io.Reader, _ int64, _ string) error
- func (s *MemoryStorage) Remove(_ context.Context, key string) error
- func (s *MemoryStorage) Stat(_ context.Context, key string) (bool, error)
- type TestDB
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MemoryStorage ¶
type MemoryStorage struct {
// contains filtered or unexported fields
}
MemoryStorage substitutes only object bytes. Integration tests still use the real media use case, source rows, ownership checks and reference transactions.
func NewMemoryStorage ¶
func NewMemoryStorage() *MemoryStorage
func (*MemoryStorage) Get ¶
func (s *MemoryStorage) Get(_ context.Context, key string) (io.ReadCloser, string, error)
func (*MemoryStorage) GetRange ¶
func (s *MemoryStorage) GetRange(_ context.Context, key string, offset, length int64) (io.ReadCloser, error)
type TestDB ¶
TestDB is a disposable PostgreSQL instance with the real schema applied — integration tests exercise the actual sqlc queries against it instead of mocks.
func SetupTestDB ¶
SetupTestDB gives the test its own PostgreSQL database with the real schema (cloned from a template inside one shared container, started by the first test of the binary) and returns live Queries. The database is dropped via t.Cleanup. When Docker is not available the test is skipped, so the suite stays runnable on machines without it.