diff options
author | Vasilii Iakliushin <viakliushin@gitlab.com> | 2021-03-29 16:28:40 +0300 |
---|---|---|
committer | Vasilii Iakliushin <viakliushin@gitlab.com> | 2021-03-29 16:28:40 +0300 |
commit | 520ec62cfaa60d39ca3ab1c60d3eb7b5372398b5 (patch) | |
tree | c0e50565ea51d31596f3e2e46141ec70baed0061 | |
parent | 5c89dd6aa41a5813f378a998dc2cd7765c0d0811 (diff) |
Update test syntax
-rw-r--r-- | internal/gitaly/service/diff/commit_test.go | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/internal/gitaly/service/diff/commit_test.go b/internal/gitaly/service/diff/commit_test.go index 2f87ebd12..6b9a4467a 100644 --- a/internal/gitaly/service/diff/commit_test.go +++ b/internal/gitaly/service/diff/commit_test.go @@ -1,6 +1,7 @@ package diff import ( + "bytes" "fmt" "io" "testing" @@ -398,20 +399,13 @@ func TestSuccessfulCommitDiffRequestWithIgnoreWhitespaceChange(t *testing.T) { } func TestSuccessfulCommitDiffRequestWithWordDiff(t *testing.T) { - server, serverSocketPath := runDiffServer(t) - defer server.Stop() - - client, conn := newDiffClient(t, serverSocketPath) - defer conn.Close() - - testRepo, testRepoPath, cleanupFn := gittest.CloneRepo(t) - defer cleanupFn() + _, repo, repoPath, client := setupDiffService(t) rightCommit := "ab2c9622c02288a2bbaaf35d96088cfdff31d9d9" leftCommit := "8a0f2ee90d940bfb0ba1e14e8214b0649056e4ab" var diffPatches [][]byte - output := testhelper.MustRunCommand(t, nil, "git", "-C", testRepoPath, "diff", "--word-diff=porcelain", leftCommit, rightCommit) + output := testhelper.MustRunCommand(t, nil, "git", "-C", repoPath, "diff", "--word-diff=porcelain", leftCommit, rightCommit) diffPerFile := bytes.Split(output, []byte("diff --git")) for _, s := range diffPerFile { @@ -570,9 +564,9 @@ func TestSuccessfulCommitDiffRequestWithWordDiff(t *testing.T) { for _, testCase := range testCases { t.Run(testCase.desc, func(t *testing.T) { - testhelper.MustRunCommand(t, nil, "git", "-C", testRepoPath, "config", "diff.noprefix", testCase.noPrefixConfig) + testhelper.MustRunCommand(t, nil, "git", "-C", repoPath, "config", "diff.noprefix", testCase.noPrefixConfig) rpcRequest := &gitalypb.CommitDiffRequest{ - Repository: testRepo, + Repository: repo, RightCommitId: rightCommit, LeftCommitId: leftCommit, IgnoreWhitespaceChange: false, |