Documentation
¶
Overview ¶
Package repotesting contains test utilities for working with repositories.
Index ¶
- Constants
- func New(ctx context.Context, opt *ReconnectableStorageOptions, isCreate bool) (blob.Storage, error)
- func NewReconnectableStorage(tb testing.TB, st blob.Storage) blob.Storage
- type Environment
- func (e *Environment) Close(ctx context.Context, tb testing.TB)
- func (e *Environment) ConfigFile() string
- func (e *Environment) LocalPathSourceInfo(path string) snapshot.SourceInfo
- func (e *Environment) MustConnectOpenAnother(tb testing.TB, openOpts ...func(*repo.Options)) repo.Repository
- func (e *Environment) MustOpenAnother(tb testing.TB, openOpts ...func(*repo.Options)) repo.RepositoryWriter
- func (e *Environment) MustReopen(tb testing.TB, openOpts ...func(*repo.Options))
- func (e *Environment) RepositoryMetrics() *metrics.Registry
- func (e *Environment) RootStorage() blob.Storage
- func (e *Environment) VerifyBlobCount(tb testing.TB, want int)
- type Options
- type ReconnectableStorageOptions
Constants ¶
const DefaultPasswordForTesting = "foobarbazfoobarbaz"
DefaultPasswordForTesting is the default password to use for all testing repositories.
const FormatNotImportant = format.FormatVersion3
FormatNotImportant chooses arbitrary format version where it's not important to the test.
const ReconnectableStorageType = "reconnectable"
ReconnectableStorageType is the unique storage type identifier for reconnectable storage backend.
Variables ¶
This section is empty.
Functions ¶
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 ¶
func NewEnvironment(tb testing.TB, version format.Version, 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 ¶
func (e *Environment) ConfigFile() string
ConfigFile returns the name of the config file.
func (*Environment) LocalPathSourceInfo ¶
func (e *Environment) LocalPathSourceInfo(path string) snapshot.SourceInfo
LocalPathSourceInfo is a convenience method that returns SourceInfo for the local user and path.
func (*Environment) MustConnectOpenAnother ¶
func (e *Environment) MustConnectOpenAnother(tb testing.TB, openOpts ...func(*repo.Options)) repo.Repository
MustConnectOpenAnother opens another repository backed by the same storage, with independent config and cache options.
func (*Environment) MustOpenAnother ¶
func (e *Environment) MustOpenAnother(tb testing.TB, openOpts ...func(*repo.Options)) repo.RepositoryWriter
MustOpenAnother opens another repository backed by the same storage location.
func (*Environment) MustReopen ¶
func (e *Environment) MustReopen(tb testing.TB, openOpts ...func(*repo.Options))
MustReopen closes and reopens the repository.
func (*Environment) RepositoryMetrics ¶
func (e *Environment) RepositoryMetrics() *metrics.Registry
RepositoryMetrics returns metrics.Registry associated with a repository.
func (*Environment) RootStorage ¶
func (e *Environment) RootStorage() blob.Storage
RootStorage returns the base storage map that implements the base in-memory map at the base of all storage wrappers on top.
func (*Environment) VerifyBlobCount ¶
func (e *Environment) VerifyBlobCount(tb testing.TB, want int)
VerifyBlobCount verifies that the underlying storage contains the specified number of blobs.
type Options ¶
type Options struct { ConnectOptions func(*repo.ConnectOptions) NewRepositoryOptions func(*repo.NewRepositoryOptions) OpenOptions func(*repo.Options) }
Options used during Environment Setup.
type ReconnectableStorageOptions ¶
type ReconnectableStorageOptions struct {
UUID string
}
ReconnectableStorageOptions provides options to reconnectable storage.