diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-12-01 16:00:36 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-12-01 18:08:12 +0300 |
commit | 8dfc0cde0ef9e8dfe8f4f0826a91b830bbee7c46 (patch) | |
tree | 638352585b6d675d281e3dae667ac19241b64077 | |
parent | beed7f98615584976d09368afc1443ea91349ac6 (diff) |
cleanup: Simplify test setup for invalid input
The tests for invalid input in the ApplyBfgObjectMapStream RPC set up
data that is not really required in the first place as we would fail
anyway before the data would even be processed. Remove this data to
simplify the test setup.
-rw-r--r-- | internal/gitaly/service/cleanup/apply_bfg_object_map_stream_test.go | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/internal/gitaly/service/cleanup/apply_bfg_object_map_stream_test.go b/internal/gitaly/service/cleanup/apply_bfg_object_map_stream_test.go index 388c4b973..25dd11c0b 100644 --- a/internal/gitaly/service/cleanup/apply_bfg_object_map_stream_test.go +++ b/internal/gitaly/service/cleanup/apply_bfg_object_map_stream_test.go @@ -106,27 +106,19 @@ func requireEntry(t *testing.T, entry *gitalypb.ApplyBfgObjectMapStreamResponse_ } func TestApplyBfgObjectMapStreamFailsOnInvalidInput(t *testing.T) { - ctx := testhelper.Context(t) + t.Parallel() - cfg, protoRepo, _, client := setupCleanupService(t, ctx) + ctx := testhelper.Context(t) + _, repoProto, _, client := setupCleanupService(t, ctx) t.Run("invalid object map", func(t *testing.T) { - entries, err := doStreamingRequest(t, ctx, protoRepo, client, "invalid-data here as you can see") + entries, err := doStreamingRequest(t, ctx, repoProto, client, "invalid-data here as you can see") require.Empty(t, entries) testhelper.RequireGrpcCode(t, err, codes.InvalidArgument) }) - repo := localrepo.NewTestRepo(t, cfg, protoRepo) - headCommit, err := repo.ReadCommit(ctx, "HEAD") - require.NoError(t, err) - - objectMapData := fmt.Sprintf( - "old new\n%s %s\n", - headCommit.Id, git.ObjectHashSHA1.ZeroOID.String(), - ) - t.Run("no repository provided", func(t *testing.T) { - entries, err := doStreamingRequest(t, ctx, nil, client, objectMapData) + entries, err := doStreamingRequest(t, ctx, nil, client, "does not matter") require.Empty(t, entries) testhelper.RequireGrpcError(t, status.Error(codes.InvalidArgument, testhelper.GitalyOrPraefect( "empty Repository", |