Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Fargher <proglottis@gmail.com>2023-03-28 00:01:48 +0300
committerJames Fargher <proglottis@gmail.com>2023-03-28 00:01:48 +0300
commitaab0c89b7d8a817d5113143fc538334d1e74bc52 (patch)
treed06e7ce1a811d0c03220fff7d7058bc27b2439c6
parent794eecdcd498d79157100884a739fbb7373298f3 (diff)
parentfc67bede70629a43011903f6201fe9e02dee783b (diff)
Merge branch 'pks-tests-enable-sha256-object-format' into 'master'
tests: Enable testing with SHA256 object format for some simple packages See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/5554 Merged-by: James Fargher <proglottis@gmail.com> Approved-by: James Fargher <proglottis@gmail.com> Reviewed-by: James Fargher <proglottis@gmail.com> Reviewed-by: Patrick Steinhardt <psteinhardt@gitlab.com> Co-authored-by: Patrick Steinhardt <psteinhardt@gitlab.com>
-rw-r--r--cmd/gitaly-lfs-smudge/main_test.go2
-rw-r--r--cmd/gitaly-lfs-smudge/smudge_test.go2
-rw-r--r--cmd/gitaly-lfs-smudge/testhelper_test.go2
-rw-r--r--cmd/gitaly-ssh/auth_test.go11
-rw-r--r--cmd/gitaly-ssh/main_test.go2
-rw-r--r--cmd/gitaly-ssh/testhelper_test.go2
-rw-r--r--cmd/gitaly-ssh/upload_pack_test.go23
-rw-r--r--cmd/gitaly-wrapper/testhelper_test.go2
-rw-r--r--internal/gitaly/client/address_parser_test.go2
-rw-r--r--internal/gitaly/client/dial_test.go2
-rw-r--r--internal/gitaly/maintenance/daily_test.go2
-rw-r--r--internal/gitaly/maintenance/main_test.go2
-rw-r--r--internal/gitaly/maintenance/optimize_test.go20
-rw-r--r--internal/gitaly/maintenance/randomwalker_test.go2
-rw-r--r--internal/gitaly/service/internalgitaly/testhelper_test.go2
-rw-r--r--internal/gitaly/service/internalgitaly/walkrepos_test.go7
-rw-r--r--internal/gitaly/service/ssh/testhelper_test.go2
-rw-r--r--internal/gitaly/service/ssh/upload_archive_test.go14
-rw-r--r--internal/gitaly/service/ssh/upload_pack_test.go54
-rw-r--r--internal/gitaly/storage/locator_test.go2
-rw-r--r--internal/gitaly/storage/metadata_test.go2
-rw-r--r--internal/gitaly/storage/servers_test.go2
-rw-r--r--internal/gitaly/storage/testhelper_test.go2
-rw-r--r--internal/middleware/limithandler/stats_interceptor_test.go2
-rw-r--r--internal/middleware/limithandler/stats_test.go2
25 files changed, 54 insertions, 113 deletions
diff --git a/cmd/gitaly-lfs-smudge/main_test.go b/cmd/gitaly-lfs-smudge/main_test.go
index 86662a823..2b9584582 100644
--- a/cmd/gitaly-lfs-smudge/main_test.go
+++ b/cmd/gitaly-lfs-smudge/main_test.go
@@ -1,5 +1,3 @@
-//go:build !gitaly_test_sha256
-
package main
import (
diff --git a/cmd/gitaly-lfs-smudge/smudge_test.go b/cmd/gitaly-lfs-smudge/smudge_test.go
index 54a8de8ad..f3d77ba0c 100644
--- a/cmd/gitaly-lfs-smudge/smudge_test.go
+++ b/cmd/gitaly-lfs-smudge/smudge_test.go
@@ -1,5 +1,3 @@
-//go:build !gitaly_test_sha256
-
package main
import (
diff --git a/cmd/gitaly-lfs-smudge/testhelper_test.go b/cmd/gitaly-lfs-smudge/testhelper_test.go
index 282f81e54..3d4d4f31f 100644
--- a/cmd/gitaly-lfs-smudge/testhelper_test.go
+++ b/cmd/gitaly-lfs-smudge/testhelper_test.go
@@ -1,5 +1,3 @@
-//go:build !gitaly_test_sha256
-
package main
import (
diff --git a/cmd/gitaly-ssh/auth_test.go b/cmd/gitaly-ssh/auth_test.go
index 54149bcf6..0446d3875 100644
--- a/cmd/gitaly-ssh/auth_test.go
+++ b/cmd/gitaly-ssh/auth_test.go
@@ -1,5 +1,3 @@
-//go:build !gitaly_test_sha256
-
package main
import (
@@ -10,6 +8,7 @@ import (
"testing"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/v15/internal/git"
"gitlab.com/gitlab-org/gitaly/v15/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/v15/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/v15/internal/gitaly/service/setup"
@@ -28,10 +27,10 @@ func TestConnectivity(t *testing.T) {
testcfg.BuildGitalySSH(t, cfg)
testcfg.BuildGitalyHooks(t, cfg)
- repo, _ := gittest.CreateRepository(t, ctx, cfg, gittest.CreateRepositoryConfig{
+ repo, repoPath := gittest.CreateRepository(t, ctx, cfg, gittest.CreateRepositoryConfig{
SkipCreationViaService: true,
- Seed: gittest.SeedGitLabTest,
})
+ gittest.WriteCommit(t, cfg, repoPath, gittest.WithBranch(git.DefaultBranch))
cwd, err := os.Getwd()
require.NoError(t, err)
@@ -131,8 +130,8 @@ func TestConnectivity(t *testing.T) {
output := gittest.ExecOpts(t, cfg, gittest.ExecConfig{
Env: env,
- }, "ls-remote", "git@localhost:test/test.git", "refs/heads/master")
- require.True(t, strings.HasSuffix(strings.TrimSpace(string(output)), "refs/heads/master"))
+ }, "ls-remote", "git@localhost:test/test.git", git.DefaultRef.String())
+ require.True(t, strings.HasSuffix(strings.TrimSpace(string(output)), git.DefaultRef.String()))
})
}
}
diff --git a/cmd/gitaly-ssh/main_test.go b/cmd/gitaly-ssh/main_test.go
index ca402f3f5..221585361 100644
--- a/cmd/gitaly-ssh/main_test.go
+++ b/cmd/gitaly-ssh/main_test.go
@@ -1,5 +1,3 @@
-//go:build !gitaly_test_sha256
-
package main
import (
diff --git a/cmd/gitaly-ssh/testhelper_test.go b/cmd/gitaly-ssh/testhelper_test.go
index 6b4c7f0f6..f86d24a5e 100644
--- a/cmd/gitaly-ssh/testhelper_test.go
+++ b/cmd/gitaly-ssh/testhelper_test.go
@@ -1,5 +1,3 @@
-//go:build !gitaly_test_sha256
-
package main
import (
diff --git a/cmd/gitaly-ssh/upload_pack_test.go b/cmd/gitaly-ssh/upload_pack_test.go
index 4da7f3ec9..06a30dcec 100644
--- a/cmd/gitaly-ssh/upload_pack_test.go
+++ b/cmd/gitaly-ssh/upload_pack_test.go
@@ -1,5 +1,3 @@
-//go:build !gitaly_test_sha256
-
package main
import (
@@ -11,8 +9,6 @@ import (
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/v15/internal/git"
"gitlab.com/gitlab-org/gitaly/v15/internal/git/gittest"
- "gitlab.com/gitlab-org/gitaly/v15/internal/git/localrepo"
- "gitlab.com/gitlab-org/gitaly/v15/internal/git/updateref"
"gitlab.com/gitlab-org/gitaly/v15/internal/gitaly/service/setup"
"gitlab.com/gitlab-org/gitaly/v15/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/v15/internal/testhelper/testcfg"
@@ -34,23 +30,14 @@ func TestVisibilityOfHiddenRefs(t *testing.T) {
repo, repoPath := gittest.CreateRepository(t, ctx, cfg, gittest.CreateRepositoryConfig{
SkipCreationViaService: true,
- Seed: gittest.SeedGitLabTest,
})
address := testserver.RunGitalyServer(t, cfg, nil, setup.RegisterAll, testserver.WithDisablePraefect())
// Create a keep-around ref
- existingSha := git.ObjectID("1e292f8fedd741b75372e19097c76d327140c312")
- keepAroundRef := fmt.Sprintf("%s/%s", keepAroundNamespace, existingSha)
-
- localRepo := localrepo.NewTestRepo(t, cfg, repo)
- updater, err := updateref.New(ctx, localRepo)
- defer testhelper.MustClose(t, updater)
-
- require.NoError(t, err)
- require.NoError(t, updater.Start())
- require.NoError(t, updater.Create(git.ReferenceName(keepAroundRef), existingSha))
- require.NoError(t, updater.Commit())
+ commitID := gittest.WriteCommit(t, cfg, repoPath)
+ keepAroundRef := fmt.Sprintf("%s/%s", keepAroundNamespace, commitID)
+ gittest.WriteRef(t, cfg, repoPath, git.ReferenceName(keepAroundRef), commitID)
gittest.Exec(t, cfg, "-C", repoPath, "config", "transfer.hideRefs", keepAroundNamespace)
@@ -96,9 +83,9 @@ func TestVisibilityOfHiddenRefs(t *testing.T) {
}, "ls-remote", fmt.Sprintf("%s:%s", "git@localhost", repoPath), keepAroundRef)
if test.HiddenRefFound {
- require.Equal(t, fmt.Sprintf("%s\t%s\n", existingSha, keepAroundRef), string(stdout))
+ require.Equal(t, fmt.Sprintf("%s\t%s\n", commitID, keepAroundRef), string(stdout))
} else {
- require.NotEqual(t, fmt.Sprintf("%s\t%s\n", existingSha, keepAroundRef), string(stdout))
+ require.NotEqual(t, fmt.Sprintf("%s\t%s\n", commitID, keepAroundRef), string(stdout))
}
})
}
diff --git a/cmd/gitaly-wrapper/testhelper_test.go b/cmd/gitaly-wrapper/testhelper_test.go
index 6b4c7f0f6..f86d24a5e 100644
--- a/cmd/gitaly-wrapper/testhelper_test.go
+++ b/cmd/gitaly-wrapper/testhelper_test.go
@@ -1,5 +1,3 @@
-//go:build !gitaly_test_sha256
-
package main
import (
diff --git a/internal/gitaly/client/address_parser_test.go b/internal/gitaly/client/address_parser_test.go
index 3069d7e96..f5dc2f31b 100644
--- a/internal/gitaly/client/address_parser_test.go
+++ b/internal/gitaly/client/address_parser_test.go
@@ -1,5 +1,3 @@
-//go:build !gitaly_test_sha256
-
package client
import (
diff --git a/internal/gitaly/client/dial_test.go b/internal/gitaly/client/dial_test.go
index c7c97a10f..5762301e9 100644
--- a/internal/gitaly/client/dial_test.go
+++ b/internal/gitaly/client/dial_test.go
@@ -1,5 +1,3 @@
-//go:build !gitaly_test_sha256
-
package client
import (
diff --git a/internal/gitaly/maintenance/daily_test.go b/internal/gitaly/maintenance/daily_test.go
index 689052e67..9cfbe8780 100644
--- a/internal/gitaly/maintenance/daily_test.go
+++ b/internal/gitaly/maintenance/daily_test.go
@@ -1,5 +1,3 @@
-//go:build !gitaly_test_sha256
-
package maintenance
import (
diff --git a/internal/gitaly/maintenance/main_test.go b/internal/gitaly/maintenance/main_test.go
index c3fa08ae7..ca345df2b 100644
--- a/internal/gitaly/maintenance/main_test.go
+++ b/internal/gitaly/maintenance/main_test.go
@@ -1,5 +1,3 @@
-//go:build !gitaly_test_sha256
-
package maintenance
import (
diff --git a/internal/gitaly/maintenance/optimize_test.go b/internal/gitaly/maintenance/optimize_test.go
index 754c94f46..a76e85040 100644
--- a/internal/gitaly/maintenance/optimize_test.go
+++ b/internal/gitaly/maintenance/optimize_test.go
@@ -1,11 +1,8 @@
-//go:build !gitaly_test_sha256
-
package maintenance
import (
"context"
"math/rand"
- "path/filepath"
"testing"
"github.com/stretchr/testify/require"
@@ -42,19 +39,30 @@ func (mo *mockOptimizer) OptimizeRepository(ctx context.Context, repository repo
}
func TestOptimizeReposRandomly(t *testing.T) {
+ t.Parallel()
+
+ ctx := testhelper.Context(t)
cfgBuilder := testcfg.NewGitalyCfgBuilder(testcfg.WithStorages("0", "1", "2"))
cfg := cfgBuilder.Build(t)
for _, storage := range cfg.Storages {
- gittest.Exec(t, cfg, "init", "--bare", filepath.Join(storage.Path, "a"))
- gittest.Exec(t, cfg, "init", "--bare", filepath.Join(storage.Path, "b"))
+ gittest.CreateRepository(t, ctx, cfg, gittest.CreateRepositoryConfig{
+ SkipCreationViaService: true,
+ Storage: storage,
+ RelativePath: "a",
+ })
+
+ gittest.CreateRepository(t, ctx, cfg, gittest.CreateRepositoryConfig{
+ SkipCreationViaService: true,
+ Storage: storage,
+ RelativePath: "b",
+ })
}
cfg.Storages = append(cfg.Storages, config.Storage{
Name: "duplicate",
Path: cfg.Storages[0].Path,
})
- ctx := testhelper.Context(t)
for _, tc := range []struct {
desc string
diff --git a/internal/gitaly/maintenance/randomwalker_test.go b/internal/gitaly/maintenance/randomwalker_test.go
index 77e91b16f..000de7410 100644
--- a/internal/gitaly/maintenance/randomwalker_test.go
+++ b/internal/gitaly/maintenance/randomwalker_test.go
@@ -1,5 +1,3 @@
-//go:build !gitaly_test_sha256
-
package maintenance
import (
diff --git a/internal/gitaly/service/internalgitaly/testhelper_test.go b/internal/gitaly/service/internalgitaly/testhelper_test.go
index aa6270d19..62e8c8dc3 100644
--- a/internal/gitaly/service/internalgitaly/testhelper_test.go
+++ b/internal/gitaly/service/internalgitaly/testhelper_test.go
@@ -1,5 +1,3 @@
-//go:build !gitaly_test_sha256
-
package internalgitaly
import (
diff --git a/internal/gitaly/service/internalgitaly/walkrepos_test.go b/internal/gitaly/service/internalgitaly/walkrepos_test.go
index f5732ec32..eeb9abd43 100644
--- a/internal/gitaly/service/internalgitaly/walkrepos_test.go
+++ b/internal/gitaly/service/internalgitaly/walkrepos_test.go
@@ -1,5 +1,3 @@
-//go:build !gitaly_test_sha256
-
package internalgitaly
import (
@@ -39,6 +37,8 @@ func (w *streamWrapper) Send(resp *gitalypb.WalkReposResponse) error {
}
func TestWalkRepos(t *testing.T) {
+ t.Parallel()
+
ctx := testhelper.Context(t)
cfg := testcfg.Build(t)
@@ -49,17 +49,14 @@ func TestWalkRepos(t *testing.T) {
// of the sequence to ensure the walk proceeds normally
testRepo1, testRepo1Path := gittest.CreateRepository(t, ctx, cfg, gittest.CreateRepositoryConfig{
SkipCreationViaService: true,
- Seed: gittest.SeedGitLabTest,
RelativePath: "a",
})
deletedRepo, _ := gittest.CreateRepository(t, ctx, cfg, gittest.CreateRepositoryConfig{
SkipCreationViaService: true,
- Seed: gittest.SeedGitLabTest,
RelativePath: "b",
})
testRepo2, testRepo2Path := gittest.CreateRepository(t, ctx, cfg, gittest.CreateRepositoryConfig{
SkipCreationViaService: true,
- Seed: gittest.SeedGitLabTest,
RelativePath: "c",
})
diff --git a/internal/gitaly/service/ssh/testhelper_test.go b/internal/gitaly/service/ssh/testhelper_test.go
index f3fe393e1..2e288b8f0 100644
--- a/internal/gitaly/service/ssh/testhelper_test.go
+++ b/internal/gitaly/service/ssh/testhelper_test.go
@@ -1,5 +1,3 @@
-//go:build !gitaly_test_sha256
-
package ssh
import (
diff --git a/internal/gitaly/service/ssh/upload_archive_test.go b/internal/gitaly/service/ssh/upload_archive_test.go
index def70ee35..87be3beaa 100644
--- a/internal/gitaly/service/ssh/upload_archive_test.go
+++ b/internal/gitaly/service/ssh/upload_archive_test.go
@@ -1,5 +1,3 @@
-//go:build !gitaly_test_sha256
-
package ssh
import (
@@ -9,6 +7,7 @@ import (
"time"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/v15/internal/git"
"gitlab.com/gitlab-org/gitaly/v15/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/v15/internal/structerr"
"gitlab.com/gitlab-org/gitaly/v15/internal/testhelper"
@@ -27,9 +26,7 @@ func TestFailedUploadArchiveRequestDueToTimeout(t *testing.T) {
cfg.SocketPath = runSSHServerWithOptions(t, cfg, []ServerOpt{WithArchiveRequestTimeout(100 * time.Microsecond)})
ctx := testhelper.Context(t)
- repo, _ := gittest.CreateRepository(t, ctx, cfg, gittest.CreateRepositoryConfig{
- Seed: gittest.SeedGitLabTest,
- })
+ repo, _ := gittest.CreateRepository(t, ctx, cfg)
client := newSSHClient(t, cfg.SocketPath)
@@ -128,9 +125,8 @@ func TestUploadArchiveSuccess(t *testing.T) {
cfg.SocketPath = runSSHServer(t, cfg)
ctx := testhelper.Context(t)
- repo, _ := gittest.CreateRepository(t, ctx, cfg, gittest.CreateRepositoryConfig{
- Seed: gittest.SeedGitLabTest,
- })
+ repo, repoPath := gittest.CreateRepository(t, ctx, cfg)
+ gittest.WriteCommit(t, cfg, repoPath, gittest.WithBranch(git.DefaultBranch))
payload, err := protojson.Marshal(&gitalypb.SSHUploadArchiveRequest{
Repository: repo,
@@ -144,7 +140,7 @@ func TestUploadArchiveSuccess(t *testing.T) {
fmt.Sprintf("PATH=%s", ".:"+os.Getenv("PATH")),
fmt.Sprintf(`GIT_SSH_COMMAND=%s upload-archive`, cfg.BinaryPath("gitaly-ssh")),
},
- }, "archive", "master", "--remote=git@localhost:test/test.git")
+ }, "archive", git.DefaultBranch, "--remote=git@localhost:test/test.git")
}
func testUploadArchiveFailedResponse(t *testing.T, stream gitalypb.SSHService_SSHUploadArchiveClient) error {
diff --git a/internal/gitaly/service/ssh/upload_pack_test.go b/internal/gitaly/service/ssh/upload_pack_test.go
index cde448dda..e6376e256 100644
--- a/internal/gitaly/service/ssh/upload_pack_test.go
+++ b/internal/gitaly/service/ssh/upload_pack_test.go
@@ -1,5 +1,3 @@
-//go:build !gitaly_test_sha256
-
package ssh
import (
@@ -139,10 +137,8 @@ func TestUploadPackWithSidechannel_client(t *testing.T) {
cfg := testcfg.Build(t)
cfg.SocketPath = runSSHServer(t, cfg)
- repo, repoPath := gittest.CreateRepository(t, testhelper.Context(t), cfg, gittest.CreateRepositoryConfig{
- Seed: gittest.SeedGitLabTest,
- })
- commitID := gittest.Exec(t, cfg, "-C", repoPath, "rev-parse", "HEAD^{commit}")
+ repo, repoPath := gittest.CreateRepository(t, testhelper.Context(t), cfg)
+ commitID := gittest.WriteCommit(t, cfg, repoPath, gittest.WithBranch(git.DefaultBranch))
registry := sidechannel.NewRegistry()
clientHandshaker := sidechannel.NewClientHandshaker(testhelper.NewDiscardingLogEntry(t), registry)
@@ -168,7 +164,7 @@ func TestUploadPackWithSidechannel_client(t *testing.T) {
Repository: repo,
},
client: func(clientConn *sidechannel.ClientConn, _ func()) error {
- gittest.WritePktlineString(t, clientConn, "want "+text.ChompBytes(commitID)+" multi_ack\n")
+ gittest.WritePktlinef(t, clientConn, "want %s multi_ack\n", commitID)
gittest.WritePktlineFlush(t, clientConn)
gittest.WritePktlineString(t, clientConn, "done\n")
@@ -187,9 +183,9 @@ func TestUploadPackWithSidechannel_client(t *testing.T) {
client: func(clientConn *sidechannel.ClientConn, _ func()) error {
gittest.WritePktlineString(t, clientConn, "command=fetch\n")
gittest.WritePktlineString(t, clientConn, "agent=git/2.36.1\n")
- gittest.WritePktlineString(t, clientConn, "object-format=sha1\n")
+ gittest.WritePktlinef(t, clientConn, "object-format=%s\n", gittest.DefaultObjectHash.Format)
gittest.WritePktlineDelim(t, clientConn)
- gittest.WritePktlineString(t, clientConn, "want "+text.ChompBytes(commitID)+"\n")
+ gittest.WritePktlinef(t, clientConn, "want %s\n", commitID)
gittest.WritePktlineString(t, clientConn, "done\n")
gittest.WritePktlineFlush(t, clientConn)
@@ -206,7 +202,7 @@ func TestUploadPackWithSidechannel_client(t *testing.T) {
GitProtocol: git.ProtocolV2,
},
client: func(clientConn *sidechannel.ClientConn, _ func()) error {
- gittest.WritePktlineString(t, clientConn, "want "+text.ChompBytes(commitID)+" multi_ack\n")
+ gittest.WritePktlinef(t, clientConn, "want %s multi_ack\n", commitID)
gittest.WritePktlineFlush(t, clientConn)
gittest.WritePktlineString(t, clientConn, "done\n")
@@ -215,8 +211,8 @@ func TestUploadPackWithSidechannel_client(t *testing.T) {
return nil
},
expectedErr: structerr.NewInternal(
- "cmd wait: exit status 128, stderr: %q",
- "fatal: unknown capability 'want 1e292f8fedd741b75372e19097c76d327140c312 multi_ack'\n",
+ "cmd wait: exit status 128, stderr: \"fatal: unknown capability 'want %s multi_ack'\\n\"",
+ commitID,
),
},
{
@@ -227,9 +223,9 @@ func TestUploadPackWithSidechannel_client(t *testing.T) {
client: func(clientConn *sidechannel.ClientConn, _ func()) error {
gittest.WritePktlineString(t, clientConn, "command=fetch\n")
gittest.WritePktlineString(t, clientConn, "agent=git/2.36.1\n")
- gittest.WritePktlineString(t, clientConn, "object-format=sha1\n")
+ gittest.WritePktlinef(t, clientConn, "object-format=%s\n", gittest.DefaultObjectHash.Format)
gittest.WritePktlineDelim(t, clientConn)
- gittest.WritePktlineString(t, clientConn, "want "+text.ChompBytes(commitID)+"\n")
+ gittest.WritePktlinef(t, clientConn, "want %s\n", commitID)
gittest.WritePktlineString(t, clientConn, "done\n")
gittest.WritePktlineFlush(t, clientConn)
@@ -248,7 +244,9 @@ func TestUploadPackWithSidechannel_client(t *testing.T) {
Repository: repo,
},
client: func(clientConn *sidechannel.ClientConn, _ func()) error {
- gittest.WritePktlineString(t, clientConn, "want "+strings.Repeat("1", 40)+" multi_ack\n")
+ oid := strings.Repeat("1", gittest.DefaultObjectHash.EncodedLen())
+
+ gittest.WritePktlinef(t, clientConn, "want %s multi_ack\n", oid)
gittest.WritePktlineFlush(t, clientConn)
gittest.WritePktlineString(t, clientConn, "done\n")
@@ -257,7 +255,7 @@ func TestUploadPackWithSidechannel_client(t *testing.T) {
return nil
},
expectedErr: structerr.NewInternal("cmd wait: exit status 128, stderr: %q",
- "fatal: git upload-pack: not our ref "+strings.Repeat("1", 40)+"\n",
+ "fatal: git upload-pack: not our ref "+strings.Repeat("1", gittest.DefaultObjectHash.EncodedLen())+"\n",
),
},
{
@@ -673,9 +671,8 @@ func TestUploadPack_packObjectsHook(t *testing.T) {
cfg.SocketPath = runSSHServer(t, cfg)
- repo, _ := gittest.CreateRepository(t, testhelper.Context(t), cfg, gittest.CreateRepositoryConfig{
- Seed: gittest.SeedGitLabTest,
- })
+ repo, repoPath := gittest.CreateRepository(t, testhelper.Context(t), cfg)
+ gittest.WriteCommit(t, cfg, repoPath, gittest.WithBranch(git.DefaultBranch))
localRepoPath := testhelper.TempDir(t)
@@ -700,16 +697,15 @@ func testUploadPackWithoutSideband(t *testing.T, opts ...testcfg.Option) {
cfg.SocketPath = runSSHServer(t, cfg)
- repo, _ := gittest.CreateRepository(t, testhelper.Context(t), cfg, gittest.CreateRepositoryConfig{
- Seed: gittest.SeedGitLabTest,
- })
+ repo, repoPath := gittest.CreateRepository(t, testhelper.Context(t), cfg)
+ commitID := gittest.WriteCommit(t, cfg, repoPath, gittest.WithBranch(git.DefaultBranch))
// While Git knows the side-band-64 capability, some other clients don't. There is no way
// though to have Git not use that capability, so we're instead manually crafting a packfile
// negotiation without that capability and send it along.
negotiation := bytes.NewBuffer([]byte{})
- gittest.WritePktlineString(t, negotiation, "want 1e292f8fedd741b75372e19097c76d327140c312 multi_ack_detailed thin-pack include-tag ofs-delta agent=git/2.29.1")
- gittest.WritePktlineString(t, negotiation, "want 1e292f8fedd741b75372e19097c76d327140c312")
+ gittest.WritePktlinef(t, negotiation, "want %s multi_ack_detailed thin-pack include-tag ofs-delta agent=git/2.29.1", commitID)
+ gittest.WritePktlinef(t, negotiation, "want %s", commitID)
gittest.WritePktlineFlush(t, negotiation)
gittest.WritePktlineString(t, negotiation, "done")
@@ -733,7 +729,7 @@ func testUploadPackWithoutSideband(t *testing.T, opts ...testcfg.Option) {
out, err := uploadPack.CombinedOutput()
require.NoError(t, err)
require.True(t, uploadPack.ProcessState.Success())
- require.Contains(t, string(out), "refs/heads/master")
+ require.Contains(t, string(out), git.DefaultRef.String())
require.Contains(t, string(out), "Counting objects")
require.Contains(t, string(out), "PACK")
}
@@ -747,9 +743,7 @@ func TestUploadPack_invalidStorage(t *testing.T) {
testcfg.BuildGitalySSH(t, cfg)
- repo, _ := gittest.CreateRepository(t, testhelper.Context(t), cfg, gittest.CreateRepositoryConfig{
- Seed: gittest.SeedGitLabTest,
- })
+ repo, _ := gittest.CreateRepository(t, testhelper.Context(t), cfg)
localRepoPath := testhelper.TempDir(t)
@@ -775,9 +769,7 @@ func TestUploadPack_gitFailure(t *testing.T) {
cfg := testcfg.Build(t)
cfg.SocketPath = runSSHServer(t, cfg)
- repo, repoPath := gittest.CreateRepository(t, testhelper.Context(t), cfg, gittest.CreateRepositoryConfig{
- Seed: gittest.SeedGitLabTest,
- })
+ repo, repoPath := gittest.CreateRepository(t, testhelper.Context(t), cfg)
client := newSSHClient(t, cfg.SocketPath)
diff --git a/internal/gitaly/storage/locator_test.go b/internal/gitaly/storage/locator_test.go
index 1f53770e3..e80b5f27b 100644
--- a/internal/gitaly/storage/locator_test.go
+++ b/internal/gitaly/storage/locator_test.go
@@ -1,5 +1,3 @@
-//go:build !gitaly_test_sha256
-
package storage
import (
diff --git a/internal/gitaly/storage/metadata_test.go b/internal/gitaly/storage/metadata_test.go
index 52f4ea8d4..6c9df8d65 100644
--- a/internal/gitaly/storage/metadata_test.go
+++ b/internal/gitaly/storage/metadata_test.go
@@ -1,5 +1,3 @@
-//go:build !gitaly_test_sha256
-
package storage
import (
diff --git a/internal/gitaly/storage/servers_test.go b/internal/gitaly/storage/servers_test.go
index be5e2d2e0..4a1d945ec 100644
--- a/internal/gitaly/storage/servers_test.go
+++ b/internal/gitaly/storage/servers_test.go
@@ -1,5 +1,3 @@
-//go:build !gitaly_test_sha256
-
package storage_test
import (
diff --git a/internal/gitaly/storage/testhelper_test.go b/internal/gitaly/storage/testhelper_test.go
index c4cb43fbe..28da53d29 100644
--- a/internal/gitaly/storage/testhelper_test.go
+++ b/internal/gitaly/storage/testhelper_test.go
@@ -1,5 +1,3 @@
-//go:build !gitaly_test_sha256
-
package storage
import (
diff --git a/internal/middleware/limithandler/stats_interceptor_test.go b/internal/middleware/limithandler/stats_interceptor_test.go
index 47274a7be..0dc9a27bd 100644
--- a/internal/middleware/limithandler/stats_interceptor_test.go
+++ b/internal/middleware/limithandler/stats_interceptor_test.go
@@ -1,5 +1,3 @@
-//go:build !gitaly_test_sha256
-
package limithandler_test
import (
diff --git a/internal/middleware/limithandler/stats_test.go b/internal/middleware/limithandler/stats_test.go
index e25fd16fb..1118164ac 100644
--- a/internal/middleware/limithandler/stats_test.go
+++ b/internal/middleware/limithandler/stats_test.go
@@ -1,5 +1,3 @@
-//go:build !gitaly_test_sha256
-
package limithandler
import (