summaryrefslogtreecommitdiffstats
path: root/integrations
diff options
context:
space:
mode:
authorEthan Koenig <ethantkoenig@gmail.com>2018-02-06 01:27:24 -0800
committerLauris BH <lauris@nix.lv>2018-02-06 11:27:24 +0200
commita2648281a044f33da5492c9d7aaddb6523b65f3a (patch)
tree6d43c2b9e3fb23ae64b71af222fdf8b9944c12c0 /integrations
parenta89592d4abfef01e68e3c53a3cdb3846b03abd2b (diff)
downloadgitea-a2648281a044f33da5492c9d7aaddb6523b65f3a.tar.gz
gitea-a2648281a044f33da5492c9d7aaddb6523b65f3a.zip
Improvements to git integration test (#3466)
Diffstat (limited to 'integrations')
-rw-r--r--integrations/git_test.go18
1 files changed, 7 insertions, 11 deletions
diff --git a/integrations/git_test.go b/integrations/git_test.go
index 1ab558d7b7..49f75c4a4a 100644
--- a/integrations/git_test.go
+++ b/integrations/git_test.go
@@ -13,6 +13,7 @@ import (
"net/http"
"net/url"
"os"
+ "os/exec"
"path/filepath"
"testing"
"time"
@@ -134,7 +135,7 @@ func TestGit(t *testing.T) {
//Setup key
keyFile := filepath.Join(setting.AppDataPath, "my-testing-key")
- _, _, err := com.ExecCmd("ssh-keygen", "-f", keyFile, "-t", "rsa", "-N", "")
+ err := exec.Command("ssh-keygen", "-f", keyFile, "-t", "rsa", "-N", "").Run()
assert.NoError(t, err)
defer os.RemoveAll(keyFile)
defer os.RemoveAll(keyFile + ".pub")
@@ -152,13 +153,10 @@ func TestGit(t *testing.T) {
session.MakeRequest(t, req, http.StatusCreated)
//Setup ssh wrapper
- sshWrapper, err := ioutil.TempFile(setting.AppDataPath, "tmp-ssh-wrapper")
- sshWrapper.WriteString("#!/bin/sh\n\n")
- sshWrapper.WriteString("ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i \"" + filepath.Join(setting.AppWorkPath, keyFile) + "\" $* \n\n")
- err = sshWrapper.Chmod(os.ModePerm)
- assert.NoError(t, err)
- sshWrapper.Close()
- defer os.RemoveAll(sshWrapper.Name())
+ os.Setenv("GIT_SSH_COMMAND",
+ "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i "+
+ filepath.Join(setting.AppWorkPath, keyFile))
+ os.Setenv("GIT_SSH_VARIANT", "ssh")
//Setup clone folder
dstPath, err := ioutil.TempDir("", "repo-tmp-18")
@@ -181,7 +179,7 @@ func TestGit(t *testing.T) {
})
//TODO get url from api
t.Run("Clone", func(t *testing.T) {
- _, err = git.NewCommand("clone").AddArguments("--config", "core.sshCommand="+filepath.Join(setting.AppWorkPath, sshWrapper.Name()), u.String(), dstPath).Run()
+ _, err = git.NewCommand("clone").AddArguments(u.String(), dstPath).Run()
assert.NoError(t, err)
assert.True(t, com.IsExist(filepath.Join(dstPath, "README.md")))
})
@@ -196,8 +194,6 @@ func TestGit(t *testing.T) {
})
})
t.Run("LFS", func(t *testing.T) {
- os.Setenv("GIT_SSH_COMMAND", filepath.Join(setting.AppWorkPath, sshWrapper.Name())) //TODO remove when fixed https://github.com/git-lfs/git-lfs/issues/2215
- defer os.Unsetenv("GIT_SSH_COMMAND")
t.Run("PushCommit", func(t *testing.T) {
//Setup git LFS
_, err = git.NewCommand("lfs").AddArguments("install").RunInDir(dstPath)