diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-10-22 08:57:46 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-10-22 10:52:22 +0300 |
commit | 58cda5b101db8ed35e57446aa5326d0003a0b733 (patch) | |
tree | b0d62e7993d42204e4c2a39d47685299543b8c6b | |
parent | 044bffc7cd0c2ee09475f72a7666806541f8e78c (diff) |
remote: Try to get hints why FetchInternalRemote tests fail sometimes
The test for `FetchInternalRemote` is still failing from time to time
due to an error when executing the reference-transaction hook. Given
that we don't log errors to stderr in gitaly-hooks but instead to a
hook-specific log file, we have no indicator why the hook is failing
though.
Convert the call to use the `assert` package to continue after
FetchInternalRemote has failed such that we can have a peek at the hooks
log.
-rw-r--r-- | internal/gitaly/service/remote/fetch_internal_remote_test.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/internal/gitaly/service/remote/fetch_internal_remote_test.go b/internal/gitaly/service/remote/fetch_internal_remote_test.go index 0a7dce19a..a93114cb9 100644 --- a/internal/gitaly/service/remote/fetch_internal_remote_test.go +++ b/internal/gitaly/service/remote/fetch_internal_remote_test.go @@ -9,6 +9,7 @@ import ( "strings" "testing" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "gitlab.com/gitlab-org/gitaly/v14/client" "gitlab.com/gitlab-org/gitaly/v14/internal/git/gittest" @@ -127,7 +128,13 @@ func TestFetchInternalRemote_successful(t *testing.T) { connsPool := client.NewPool() defer connsPool.Close() - require.NoError(t, FetchInternalRemote(ctx, localCfg, connsPool, localRepo, remoteRepo)) + // Use the `assert` package while we haven't figured out this failure yet such that we can + // also verify the hook logs and hopefully get a lead. + assert.NoError(t, FetchInternalRemote(ctx, localCfg, connsPool, localRepo, remoteRepo)) + + hookLogs := filepath.Join(localCfg.Logging.Dir, "gitaly_hooks.log") + require.FileExists(t, hookLogs) + require.Equal(t, "", string(testhelper.MustReadFile(t, hookLogs))) require.Equal(t, string(gittest.Exec(t, remoteCfg, "-C", remoteRepoPath, "show-ref", "--head")), |