Documentation
¶
Index ¶
- func GenerateFiles(t *testing.T, files []MockFile) string
- func GenerateRepository(t *testing.T, bufout *bytes.Buffer, buferr *bytes.Buffer, passphrase *[]byte) (*repository.Repository, *appcontext.AppContext)
- func GenerateRepositoryWithoutConfig(t *testing.T, bufout *bytes.Buffer, buferr *bytes.Buffer, passphrase *[]byte) (*repository.Repository, *appcontext.AppContext)
- func GenerateSnapshot(t *testing.T, repo *repository.Repository, files []MockFile, ...) *snapshot.Snapshot
- func NewConfiguration(opts ...ConfigurationOptions) *storage.Configuration
- func NewMockImporter(appCtx context.Context, opts *connectors.Options, name string, ...) (importer.Importer, error)
- func StartCached(t *testing.T, ctx *appcontext.AppContext)
- type ConfigurationOptions
- type MockBackend
- func (mb *MockBackend) Close(ctx context.Context) error
- func (mb *MockBackend) Create(ctx context.Context, configuration []byte) error
- func (mb *MockBackend) Delete(ctx context.Context, res storage.StorageResource, mac objects.MAC) error
- func (mb *MockBackend) Flags() location.Flags
- func (mb *MockBackend) Get(ctx context.Context, res storage.StorageResource, mac objects.MAC, ...) (io.ReadCloser, error)
- func (mb *MockBackend) List(ctx context.Context, res storage.StorageResource) ([]objects.MAC, error)
- func (mb *MockBackend) Mode(context.Context) (storage.Mode, error)
- func (mb *MockBackend) Open(ctx context.Context) ([]byte, error)
- func (mb *MockBackend) Origin() string
- func (mb *MockBackend) Ping(ctx context.Context) error
- func (mb *MockBackend) Put(ctx context.Context, res storage.StorageResource, mac objects.MAC, ...) (int64, error)
- func (mb *MockBackend) Root() string
- func (mb *MockBackend) Size(ctx context.Context) (int64, error)
- func (mb *MockBackend) Type() string
- type MockFTPServer
- type MockFile
- type MockImporter
- func (p *MockImporter) Close(ctx context.Context) error
- func (p *MockImporter) Flags() location.Flags
- func (p *MockImporter) Import(ctx context.Context, records chan<- *connectors.Record, ...) error
- func (p *MockImporter) Origin() string
- func (p *MockImporter) Ping(ctx context.Context) error
- func (p *MockImporter) Root() string
- func (p *MockImporter) SetFiles(files []MockFile)
- func (p *MockImporter) SetGenerator(gen func(chan<- *connectors.Record))
- func (p *MockImporter) Type() string
- type TestingOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateRepository ¶
func GenerateRepository(t *testing.T, bufout *bytes.Buffer, buferr *bytes.Buffer, passphrase *[]byte) (*repository.Repository, *appcontext.AppContext)
func GenerateRepositoryWithoutConfig ¶
func GenerateRepositoryWithoutConfig(t *testing.T, bufout *bytes.Buffer, buferr *bytes.Buffer, passphrase *[]byte) (*repository.Repository, *appcontext.AppContext)
func GenerateSnapshot ¶
func GenerateSnapshot(t *testing.T, repo *repository.Repository, files []MockFile, opts ...TestingOptions) *snapshot.Snapshot
func NewConfiguration ¶
func NewConfiguration(opts ...ConfigurationOptions) *storage.Configuration
func NewMockImporter ¶
func StartCached ¶ added in v1.1.1
func StartCached(t *testing.T, ctx *appcontext.AppContext)
StartCached runs the cached daemon in-process, listening on the cached.sock of the given context's CacheDir. The cached client connects to that socket before trying to spawn an external process, so commands relying on cached (sync, backup -check, ...) can be exercised from tests as long as the server is started before they execute.
Types ¶
type ConfigurationOptions ¶
type ConfigurationOptions func(o *storage.Configuration)
func WithConfigurationCompression ¶
func WithConfigurationCompression(compression *compression.Configuration) ConfigurationOptions
type MockBackend ¶
type MockBackend struct {
// contains filtered or unexported fields
}
MockBackend implements the Backend interface for testing purposes
func NewMockBackend ¶
func NewMockBackend(storeConfig map[string]string) *MockBackend
func (*MockBackend) Create ¶
func (mb *MockBackend) Create(ctx context.Context, configuration []byte) error
func (*MockBackend) Delete ¶ added in v1.1.0
func (mb *MockBackend) Delete(ctx context.Context, res storage.StorageResource, mac objects.MAC) error
func (*MockBackend) Flags ¶ added in v1.1.0
func (mb *MockBackend) Flags() location.Flags
func (*MockBackend) Get ¶ added in v1.1.0
func (mb *MockBackend) Get(ctx context.Context, res storage.StorageResource, mac objects.MAC, rg *storage.Range) (io.ReadCloser, error)
func (*MockBackend) List ¶ added in v1.1.0
func (mb *MockBackend) List(ctx context.Context, res storage.StorageResource) ([]objects.MAC, error)
func (*MockBackend) Origin ¶ added in v1.1.0
func (mb *MockBackend) Origin() string
func (*MockBackend) Root ¶ added in v1.1.0
func (mb *MockBackend) Root() string
func (*MockBackend) Type ¶ added in v1.1.0
func (mb *MockBackend) Type() string
type MockFTPServer ¶ added in v1.0.3
type MockFTPServer struct {
Addr string
Files map[string][]byte
Dirs map[string]bool
// contains filtered or unexported fields
}
func NewMockFTPServer ¶ added in v1.0.3
func NewMockFTPServer() (*MockFTPServer, error)
func (*MockFTPServer) Close ¶ added in v1.0.3
func (s *MockFTPServer) Close()
func (*MockFTPServer) SetAuth ¶ added in v1.0.3
func (s *MockFTPServer) SetAuth(user, pass string)
type MockFile ¶
func NewMockDir ¶
func (*MockFile) ScanResult ¶
func (m *MockFile) ScanResult() *connectors.Record
type MockImporter ¶
type MockImporter struct {
// contains filtered or unexported fields
}
func (*MockImporter) Flags ¶ added in v1.1.0
func (p *MockImporter) Flags() location.Flags
func (*MockImporter) Import ¶ added in v1.1.0
func (p *MockImporter) Import(ctx context.Context, records chan<- *connectors.Record, results <-chan *connectors.Result) error
func (*MockImporter) Origin ¶
func (p *MockImporter) Origin() string
func (*MockImporter) Root ¶
func (p *MockImporter) Root() string
func (*MockImporter) SetFiles ¶
func (p *MockImporter) SetFiles(files []MockFile)
func (*MockImporter) SetGenerator ¶
func (p *MockImporter) SetGenerator(gen func(chan<- *connectors.Record))
func (*MockImporter) Type ¶
func (p *MockImporter) Type() string
type TestingOptions ¶
type TestingOptions func(o *testingOptions)
func WithExcludes ¶ added in v1.1.0
func WithExcludes(excludes []string) TestingOptions
func WithGenerator ¶
func WithGenerator(gen func(chan<- *connectors.Record)) TestingOptions
func WithName ¶
func WithName(name string) TestingOptions
Source Files
¶
Click to show internal directories.
Click to hide internal directories.