diff --git a/Makefile b/Makefile index f45eca9c6..b56f3f7fa 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/tests/end_to_end_test/snapshot_fail_test.go b/tests/end_to_end_test/snapshot_fail_test.go index 490abd9bb..a0f6c73b6 100644 --- a/tests/end_to_end_test/snapshot_fail_test.go +++ b/tests/end_to_end_test/snapshot_fail_test.go @@ -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") diff --git a/tests/testenv/cli_test_env.go b/tests/testenv/cli_test_env.go index 90d235692..948e2b5f8 100644 --- a/tests/testenv/cli_test_env.go +++ b/tests/testenv/cli_test_env.go @@ -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...)