diff options
author | Sami Hiltunen <shiltunen@gitlab.com> | 2022-02-03 16:48:01 +0300 |
---|---|---|
committer | Sami Hiltunen <shiltunen@gitlab.com> | 2022-02-03 16:53:01 +0300 |
commit | 91609f6dae4003f114181f787df16d4d1ced399a (patch) | |
tree | dc7efff1f1f68264c44dc1ab5bd28c3eae507947 | |
parent | 5a69301b2d2a65efb7f04bf05d3125b1707242a0 (diff) |
Propagate test context to setup helpers in hooks package
setupHookService helper is currently using a TODO context. This commit
propagates the test context down from the tests to the setup helper.
-rw-r--r-- | internal/gitaly/service/hook/post_receive_test.go | 2 | ||||
-rw-r--r-- | internal/gitaly/service/hook/pre_receive_test.go | 2 | ||||
-rw-r--r-- | internal/gitaly/service/hook/testhelper_test.go | 4 | ||||
-rw-r--r-- | internal/gitaly/service/hook/update_test.go | 2 |
4 files changed, 5 insertions, 5 deletions
diff --git a/internal/gitaly/service/hook/post_receive_test.go b/internal/gitaly/service/hook/post_receive_test.go index 25b7621ef..1952635ea 100644 --- a/internal/gitaly/service/hook/post_receive_test.go +++ b/internal/gitaly/service/hook/post_receive_test.go @@ -24,8 +24,8 @@ import ( ) func TestPostReceiveInvalidArgument(t *testing.T) { - _, _, _, client := setupHookService(t) ctx := testhelper.Context(t) + _, _, _, client := setupHookService(ctx, t) stream, err := client.PostReceiveHook(ctx) require.NoError(t, err) diff --git a/internal/gitaly/service/hook/pre_receive_test.go b/internal/gitaly/service/hook/pre_receive_test.go index bf85b58cb..6d67b52b1 100644 --- a/internal/gitaly/service/hook/pre_receive_test.go +++ b/internal/gitaly/service/hook/pre_receive_test.go @@ -28,8 +28,8 @@ import ( ) func TestPreReceiveInvalidArgument(t *testing.T) { - _, _, _, client := setupHookService(t) ctx := testhelper.Context(t) + _, _, _, client := setupHookService(ctx, t) stream, err := client.PreReceiveHook(ctx) require.NoError(t, err) diff --git a/internal/gitaly/service/hook/testhelper_test.go b/internal/gitaly/service/hook/testhelper_test.go index e9f06f95f..c374901aa 100644 --- a/internal/gitaly/service/hook/testhelper_test.go +++ b/internal/gitaly/service/hook/testhelper_test.go @@ -20,7 +20,7 @@ func TestMain(m *testing.M) { testhelper.Run(m) } -func setupHookService(t testing.TB) (config.Cfg, *gitalypb.Repository, string, gitalypb.HookServiceClient) { +func setupHookService(ctx context.Context, t testing.TB) (config.Cfg, *gitalypb.Repository, string, gitalypb.HookServiceClient) { t.Helper() cfg := testcfg.Build(t) @@ -28,7 +28,7 @@ func setupHookService(t testing.TB) (config.Cfg, *gitalypb.Repository, string, g client, conn := newHooksClient(t, cfg.SocketPath) t.Cleanup(func() { conn.Close() }) - repo, repoPath := gittest.CreateRepository(context.TODO(), t, cfg, gittest.CreateRepositoryConfig{ + repo, repoPath := gittest.CreateRepository(ctx, t, cfg, gittest.CreateRepositoryConfig{ Seed: gittest.SeedGitLabTest, }) diff --git a/internal/gitaly/service/hook/update_test.go b/internal/gitaly/service/hook/update_test.go index f5dcea34c..2748bf003 100644 --- a/internal/gitaly/service/hook/update_test.go +++ b/internal/gitaly/service/hook/update_test.go @@ -34,8 +34,8 @@ func TestUpdateInvalidArgument(t *testing.T) { } func TestUpdate_CustomHooks(t *testing.T) { - cfg, repo, repoPath, client := setupHookService(t) ctx := testhelper.Context(t) + cfg, repo, repoPath, client := setupHookService(ctx, t) hooksPayload, err := git.NewHooksPayload( cfg, |