diff options
author | Igor Drozdov <idrozdov@gitlab.com> | 2022-08-05 15:37:43 +0200 |
---|---|---|
committer | Igor Drozdov <idrozdov@gitlab.com> | 2022-08-05 15:37:44 +0200 |
commit | 67345c2a79749a9fe3ef828f685034e0d78e5a9e (patch) | |
tree | 7a5bec7a051b045b7d4148c99d0ddc6e48c0c2a0 /cmd/gitlab-sshd/acceptance_test.go | |
parent | 8f2a4e90923a852eb386885b9379d5953fd8781b (diff) | |
download | gitlab-shell-67345c2a79749a9fe3ef828f685034e0d78e5a9e.tar.gz |
Fix failing TestGitReceivePackSuccess
After https://gitlab.com/gitlab-org/gitaly/-/merge_requests/4766
has been introduced, the test started fail because we basically
cancel the git-receive-pack after the output is received
This commit gracefully closes the connection to make the test
pass
Diffstat (limited to 'cmd/gitlab-sshd/acceptance_test.go')
-rw-r--r-- | cmd/gitlab-sshd/acceptance_test.go | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/cmd/gitlab-sshd/acceptance_test.go b/cmd/gitlab-sshd/acceptance_test.go index 9dcb84c..31f87a5 100644 --- a/cmd/gitlab-sshd/acceptance_test.go +++ b/cmd/gitlab-sshd/acceptance_test.go @@ -387,12 +387,25 @@ func TestGitReceivePackSuccess(t *testing.T) { ensureGitalyRepository(t) client := runSSHD(t, successAPI(t)) - session, err := client.NewSession() require.NoError(t, err) defer session.Close() - output, err := session.Output(fmt.Sprintf("git-receive-pack %s", testRepo)) + stdin, err := session.StdinPipe() + require.NoError(t, err) + + stdout, err := session.StdoutPipe() + require.NoError(t, err) + + err = session.Start(fmt.Sprintf("git-receive-pack %s", testRepo)) + require.NoError(t, err) + + // Gracefully close connection + _, err = fmt.Fprintln(stdin, "0000") + require.NoError(t, err) + stdin.Close() + + output, err := io.ReadAll(stdout) require.NoError(t, err) outputLines := strings.Split(string(output), "\n") |