mirror of
https://github.com/kopia/kopia.git
synced 2026-01-27 15:58:03 -05:00
* cli: added 'repository validate-provider' which runs a set of tests against blob storage provider to validate it This implements a provider tests which exercises subtle behaviors which are not always correctly implemented by providers claiming compatibility with S3, for example. The test checks: - not found behavior - prefix scans - timestamps - write atomicity * retry: improved error message on failure * rclone: fixed stats reporting and awaiting for completion * webdav: prevent panic when attempting to mkdir with empty name * testing: run providervalidation.ValidateProvider as part of regular provider tests * cli: print a recommendation to validate provider after repository creation
36 lines
1.2 KiB
Go
36 lines
1.2 KiB
Go
package cli
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/pkg/errors"
|
|
|
|
"github.com/kopia/kopia/internal/providervalidation"
|
|
"github.com/kopia/kopia/repo"
|
|
)
|
|
|
|
type commandRepositoryValidateProvider struct {
|
|
opt providervalidation.Options
|
|
out textOutput
|
|
}
|
|
|
|
func (c *commandRepositoryValidateProvider) setup(svc advancedAppServices, parent commandParent) {
|
|
cmd := parent.Command("validate-provider", "Validates that a repository provider is compatible with Kopia")
|
|
|
|
c.opt = providervalidation.DefaultOptions
|
|
|
|
cmd.Flag("concurrency-test-duration", "Duration of concurrency test").DurationVar(&c.opt.ConcurrencyTestDuration)
|
|
cmd.Flag("put-blob-workers", "Number of PutBlob workers").IntVar(&c.opt.NumPutBlobWorkers)
|
|
cmd.Flag("get-blob-workers", "Number of GetBlob workers").IntVar(&c.opt.NumGetBlobWorkers)
|
|
cmd.Flag("get-metadata-workers", "Number of GetMetadata workers").IntVar(&c.opt.NumGetMetadataWorkers)
|
|
c.out.setup(svc)
|
|
|
|
cmd.Action(c.out.svc.directRepositoryWriteAction(c.run))
|
|
}
|
|
|
|
func (c *commandRepositoryValidateProvider) run(ctx context.Context, dr repo.DirectRepositoryWriter) error {
|
|
return errors.Wrap(
|
|
providervalidation.ValidateProvider(ctx, dr.BlobStorage(), c.opt),
|
|
"provider validation error")
|
|
}
|