Documentation ¶
Overview ¶
Package repotesting contains test utilities for working with repositories.
Index ¶
- Constants
- type Environment
- func (e *Environment) Close(ctx context.Context, tb testing.TB)
- func (e *Environment) ConfigFile() string
- func (e *Environment) MustConnectOpenAnother(tb testing.TB, openOpts ...func(*repo.Options)) repo.Repository
- func (e *Environment) MustOpenAnother(tb testing.TB) repo.RepositoryWriter
- func (e *Environment) MustReopen(tb testing.TB, openOpts ...func(*repo.Options))
- func (e *Environment) VerifyBlobCount(tb testing.TB, want int)
- type Options
Constants ¶
const FormatNotImportant = content.FormatVersion2
FormatNotImportant chooses arbitrary format version where it's not important to the test.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Environment ¶
type Environment struct { Repository repo.Repository RepositoryWriter repo.DirectRepositoryWriter Password string // contains filtered or unexported fields }
Environment encapsulates details of a test environment.
func NewEnvironment ¶ added in v0.8.0
func NewEnvironment(tb testing.TB, version content.FormatVersion, opts ...Options) (context.Context, *Environment)
NewEnvironment creates a new repository testing environment and ensures its cleanup at the end of the test.
func (*Environment) Close ¶
func (e *Environment) Close(ctx context.Context, tb testing.TB)
Close closes testing environment.
func (*Environment) ConfigFile ¶ added in v0.8.0
func (e *Environment) ConfigFile() string
ConfigFile returns the name of the config file.
func (*Environment) MustConnectOpenAnother ¶ added in v0.7.0
func (e *Environment) MustConnectOpenAnother(tb testing.TB, openOpts ...func(*repo.Options)) repo.Repository
MustConnectOpenAnother opens another repository backend by the same storage, with independent config and cache options.
func (*Environment) MustOpenAnother ¶ added in v0.6.0
func (e *Environment) MustOpenAnother(tb testing.TB) repo.RepositoryWriter
MustOpenAnother opens another repository backend by the same storage.
func (*Environment) MustReopen ¶
func (e *Environment) MustReopen(tb testing.TB, openOpts ...func(*repo.Options))
MustReopen closes and reopens the repository.
func (*Environment) VerifyBlobCount ¶
func (e *Environment) VerifyBlobCount(tb testing.TB, want int)
VerifyBlobCount verifies that the underlying storage contains the specified number of blobs.