diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2023-08-31 09:26:35 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2023-09-11 09:10:13 +0300 |
commit | c134fbcaccba8a96a6dd265acb529338b1c5f1a1 (patch) | |
tree | 524c20489b016dd9e00fdcc08ffe3d52cb806822 | |
parent | e7e38b42d14bd849c49e24034f750fc210c226ae (diff) |
remote: Fix test for FindRemoteRootRef commands not consuming stdout
While our tests for `findRemoteRootRefCmd()` call `Wait()` on the
created commands, the output that they generate is never getting read by
us. This has been fine until now, but in the next commit we'll introduce
a mechanism to more readily detect mishandled stdout streams.
Let's prepare for this change by fully reading the output.
-rw-r--r-- | internal/gitaly/service/remote/find_remote_root_ref_test.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/internal/gitaly/service/remote/find_remote_root_ref_test.go b/internal/gitaly/service/remote/find_remote_root_ref_test.go index 4e7be7230..8b8198672 100644 --- a/internal/gitaly/service/remote/find_remote_root_ref_test.go +++ b/internal/gitaly/service/remote/find_remote_root_ref_test.go @@ -2,6 +2,7 @@ package remote import ( "fmt" + "io" "path/filepath" "testing" @@ -201,7 +202,10 @@ func TestServer_findRemoteRootRefCmd(t *testing.T) { t.Run(tc.desc, func(t *testing.T) { cmd, err := s.findRemoteRootRefCmd(ctx, tc.request) require.Equal(t, tc.expectedErr, err) + if err == nil { + _, err := io.ReadAll(cmd) + require.NoError(t, err) require.NoError(t, cmd.Wait()) require.Subset(t, cmd.Env(), tc.expectedConfig) } |