mirror of
https://github.com/kopia/kopia.git
synced 2026-10-22 14:15:03 -04:00
travis: add integration tests and install-noui on Windows
This commit is contained in:
1 parent
edca1733b6
commit
75929f65e9
3 files changed
+23
-11
No files matched your search
@@ -2,6 +2,7 @@ COVERAGE_PACKAGES=github.com/kopia/kopia/repo/...,github.com/kopia/kopia/fs/...,
|
||||
GO_TEST=go test
|
||||
PARALLEL=8
|
||||
TEST_FLAGS=
|
||||
KOPIA_INTEGRATION_EXE=$(CURDIR)/dist/integration/kopia.exe
|
||||
|
||||
all: test lint vet integration-tests
|
||||
|
||||
@@ -71,7 +72,8 @@ kopia-ui: goreleaser
|
||||
$(MAKE) -C app $(KOPIA_UI_BUILD_TARGET)
|
||||
|
||||
ifeq ($(TRAVIS_OS_NAME),windows)
|
||||
travis-release: test
|
||||
travis-release: install-noui test
|
||||
$(MAKE) integration-tests
|
||||
endif
|
||||
|
||||
ifeq ($(TRAVIS_OS_NAME),osx)
|
||||
@@ -140,10 +142,10 @@ vtest:
|
||||
$(GO_TEST) -count=1 -short -v -timeout 90s github.com/kopia/kopia/...
|
||||
|
||||
dist-binary:
|
||||
go build -o dist/integration/kopia github.com/kopia/kopia
|
||||
go build -o $(KOPIA_INTEGRATION_EXE) github.com/kopia/kopia
|
||||
|
||||
integration-tests: dist-binary
|
||||
KOPIA_EXE=$(CURDIR)/dist/integration/kopia $(GO_TEST) $(TEST_FLAGS) -count=1 -parallel $(PARALLEL) -timeout 300s github.com/kopia/kopia/tests/end_to_end_test
|
||||
KOPIA_EXE=$(KOPIA_INTEGRATION_EXE) $(GO_TEST) $(TEST_FLAGS) -count=1 -parallel $(PARALLEL) -timeout 300s github.com/kopia/kopia/tests/end_to_end_test
|
||||
|
||||
stress-test:
|
||||
KOPIA_LONG_STRESS_TEST=1 $(GO_TEST) -count=1 -timeout 200s github.com/kopia/kopia/tests/stress_test
|
||||
@@ -199,7 +201,7 @@ ifneq ($(TRAVIS_TAG),)
|
||||
|
||||
travis-create-long-term-repository: dist-binary travis-install-cloud-sdk
|
||||
echo Creating long-term repository $(TRAVIS_TAG)...
|
||||
KOPIA_EXE=$(CURDIR)/dist/integration/kopia ./tests/compat_test/gen-compat-repo.sh
|
||||
KOPIA_EXE=$(KOPIA_INTEGRATION_EXE) ./tests/compat_test/gen-compat-repo.sh
|
||||
|
||||
else
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"testing"
|
||||
|
||||
@@ -14,6 +15,10 @@ import (
|
||||
func TestSnapshotFail(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
if runtime.GOOS == "windows" {
|
||||
t.Skip("this test does not work on Windows")
|
||||
}
|
||||
|
||||
e := testenv.NewCLITest(t)
|
||||
defer e.Cleanup(t)
|
||||
defer e.RunAndExpectSuccess(t, "repo", "disconnect")
|
||||
|
||||
@@ -55,9 +55,9 @@ type SnapshotInfo struct {
|
||||
|
||||
// NewCLITest creates a new instance of *CLITest
|
||||
func NewCLITest(t *testing.T) *CLITest {
|
||||
Exe := os.Getenv("KOPIA_EXE")
|
||||
if Exe == "" {
|
||||
// Exe = "kopia"
|
||||
exe := os.Getenv("KOPIA_EXE")
|
||||
if exe == "" {
|
||||
// exe = "kopia"
|
||||
t.Skip()
|
||||
}
|
||||
|
||||
@@ -76,16 +76,21 @@ func NewCLITest(t *testing.T) *CLITest {
|
||||
"--config-file", filepath.Join(ConfigDir, ".kopia.config"),
|
||||
}
|
||||
|
||||
if runtime.GOOS == "darwin" {
|
||||
// this prevents kopia from spawning `security` subprocess which speeds up the test on macOS.
|
||||
// disable the use of keyring
|
||||
switch runtime.GOOS {
|
||||
case "darwin":
|
||||
fixedArgs = append(fixedArgs, "--no-use-keychain")
|
||||
case "windows":
|
||||
fixedArgs = append(fixedArgs, "--no-use-credential-manager")
|
||||
case "linux":
|
||||
fixedArgs = append(fixedArgs, "--no-use-keyring")
|
||||
}
|
||||
|
||||
return &CLITest{
|
||||
startTime: time.Now(),
|
||||
RepoDir: RepoDir,
|
||||
ConfigDir: ConfigDir,
|
||||
Exe: Exe,
|
||||
Exe: filepath.FromSlash(exe),
|
||||
fixedArgs: fixedArgs,
|
||||
environment: []string{"KOPIA_PASSWORD=" + repoPassword},
|
||||
}
|
||||
@@ -194,7 +199,7 @@ func (e *CLITest) RunAndVerifyOutputLineCount(t *testing.T, wantLines int, args
|
||||
// Run executes kopia with given arguments and returns the output lines.
|
||||
func (e *CLITest) Run(t *testing.T, args ...string) (stdout, stderr []string, err error) {
|
||||
t.Helper()
|
||||
t.Logf("running 'kopia %v'", strings.Join(args, " "))
|
||||
t.Logf("running '%v %v'", e.Exe, strings.Join(args, " "))
|
||||
// nolint:gosec
|
||||
cmdArgs := append(append([]string(nil), e.fixedArgs...), args...)
|
||||
|
||||
|
||||
Reference in new issue
Block a user