mirror of
https://github.com/kopia/kopia.git
synced 2026-01-24 22:38:00 -05:00
* cli: added a flag to create repository with v2 index features * content: plumb through compression.ID parameter to content.Manager.WriteContent() * content: expose content.Manager.SupportsContentCompression This allows object manager to decide whether to create compressed object or let the content manager do it. * object: if compression is requested and the repo supports it, pass compression ID to the content manager * cli: show compression status in 'repository status' * cli: output compression information in 'content list' and 'content stats' * content: compression and decompression support * content: unit tests for compression * object: compression tests * testing: added integration tests against v2 index * testing: run all e2e tests with and without content-level compression * htmlui: added UI for specifying index format on creation * cli: additional tests for 'content ls' and 'content stats' * applied pr suggestions
48 lines
1.2 KiB
Go
48 lines
1.2 KiB
Go
package testenv
|
|
|
|
import (
|
|
"io"
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/kopia/kopia/cli"
|
|
"github.com/kopia/kopia/internal/buf"
|
|
"github.com/kopia/kopia/internal/testlogging"
|
|
)
|
|
|
|
// CLIInProcRunner is a CLIRunner that invokes provided commands in the current process.
|
|
type CLIInProcRunner struct{}
|
|
|
|
// Start implements CLIRunner.
|
|
func (e *CLIInProcRunner) Start(t *testing.T, args []string) (stdout, stderr io.Reader, wait func() error, kill func()) {
|
|
t.Helper()
|
|
|
|
ctx := testlogging.Context(t)
|
|
|
|
a := cli.NewApp()
|
|
a.AdvancedCommands = "enabled"
|
|
|
|
return a.RunSubcommand(ctx, append([]string{
|
|
"--password", TestRepoPassword,
|
|
}, args...))
|
|
}
|
|
|
|
// NewInProcRunner returns a runner that executes CLI subcommands in the current process using cli.RunSubcommand().
|
|
func NewInProcRunner(t *testing.T) *CLIInProcRunner {
|
|
t.Helper()
|
|
|
|
if os.Getenv("KOPIA_EXE") != "" && os.Getenv("KOPIA_RUN_ALL_INTEGRATION_TESTS") == "" {
|
|
t.Skip("not running test since it's also included in the unit tests")
|
|
}
|
|
|
|
return &CLIInProcRunner{}
|
|
}
|
|
|
|
var _ CLIRunner = (*CLIInProcRunner)(nil)
|
|
|
|
func init() {
|
|
// disable buffer management in end-to-end tests as running too many of them in parallel causes too
|
|
// much memory usage on low-end platforms.
|
|
buf.DisableBufferManagement = true
|
|
}
|