mirror of
https://github.com/kopia/kopia.git
synced 2026-05-11 16:25:13 -04:00
cli: added tests for benchmark subcommands
This commit is contained in:
42
cli/command_benchmark_test.go
Normal file
42
cli/command_benchmark_test.go
Normal file
@@ -0,0 +1,42 @@
|
||||
package cli_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io/ioutil"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/kopia/kopia/internal/testutil"
|
||||
"github.com/kopia/kopia/tests/testenv"
|
||||
)
|
||||
|
||||
func TestCommandBenchmarkCrypto(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
runner := testenv.NewInProcRunner(t)
|
||||
e := testenv.NewCLITest(t, runner)
|
||||
|
||||
e.RunAndExpectSuccess(t, "benchmark", "crypto", "--repeat=1", "--block-size=1KB", "--print-options")
|
||||
}
|
||||
|
||||
func TestCommandBenchmarkSpliter(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
runner := testenv.NewInProcRunner(t)
|
||||
e := testenv.NewCLITest(t, runner)
|
||||
|
||||
e.RunAndExpectSuccess(t, "benchmark", "splitter", "--block-count=1", "--print-options")
|
||||
}
|
||||
|
||||
func TestCommandBenchmarkCompression(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
runner := testenv.NewInProcRunner(t)
|
||||
e := testenv.NewCLITest(t, runner)
|
||||
|
||||
testFile := filepath.Join(testutil.TempDirectory(t), "testfile.txt")
|
||||
ioutil.WriteFile(testFile, bytes.Repeat([]byte{1, 2, 3, 4, 5, 6}, 10000), 0600)
|
||||
|
||||
e.RunAndExpectSuccess(t, "benchmark", "compression", "--data-file", testFile, "--repeat=2", "--verify-stable", "--print-options")
|
||||
e.RunAndExpectSuccess(t, "benchmark", "compression", "--data-file", testFile, "--repeat=2", "--by-size")
|
||||
}
|
||||
Reference in New Issue
Block a user