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:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2022-06-09 14:41:41 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2022-06-15 08:55:30 +0300
commit5420c0472e72ee0c867ff7f28835f02a7e363d5d (patch)
treee3af124f60731b2dc1616489d625a95c5de75686
parent525d2d7b687fd0d79ef89b0c5923ca18971a40dd (diff)
ssh: Merge hidden tag tests into successful tests
The tests which exercise whether we can pass Git configuration to SSHUploadPack with hidden tags as a proxy use the same setup as our other tests which verify that this RPC works alright. Merge both tests into a single one to reduce code duplication.
-rw-r--r--internal/gitaly/service/ssh/upload_pack_test.go60
1 files changed, 21 insertions, 39 deletions
diff --git a/internal/gitaly/service/ssh/upload_pack_test.go b/internal/gitaly/service/ssh/upload_pack_test.go
index fddd2acde..15474097b 100644
--- a/internal/gitaly/service/ssh/upload_pack_test.go
+++ b/internal/gitaly/service/ssh/upload_pack_test.go
@@ -313,6 +313,27 @@ func testUploadPackCloneSuccess(t *testing.T, sidechannel bool, opts ...testcfg.
gittest.RequireObjectExists(t, cfg, repoPath, blobLessThanLimit)
},
},
+ {
+ desc: "hidden tags",
+ cloneFlags: []git.Option{
+ git.Flag{Name: "--mirror"},
+ },
+ request: &gitalypb.SSHUploadPackRequest{
+ Repository: repo,
+ GitConfigOptions: []string{
+ "transfer.hideRefs=refs/tags",
+ },
+ },
+ verify: func(t *testing.T, localRepoPath string) {
+ // Assert that there is at least one tag that should've been cloned
+ // if refs weren't hidden as expected
+ require.NotEmpty(t, gittest.Exec(t, cfg, "-C", repoPath, "tag"))
+
+ // And then verify that we did indeed hide tags as expected, which
+ // is demonstrated by not having fetched any tags.
+ require.Empty(t, gittest.Exec(t, cfg, "-C", localRepoPath, "tag"))
+ },
+ },
} {
t.Run(tc.desc, func(t *testing.T) {
localRepoPath := testhelper.TempDir(t)
@@ -443,45 +464,6 @@ func testUploadPackWithoutSideband(t *testing.T, opts ...testcfg.Option) {
require.Contains(t, string(out), "PACK")
}
-func TestUploadPackCloneHideTags(t *testing.T) {
- t.Parallel()
-
- ctx := testhelper.Context(t)
- cfg := testcfg.Build(t)
-
- testcfg.BuildGitalySSH(t, cfg)
- testcfg.BuildGitalyHooks(t, cfg)
-
- cfg.SocketPath = runSSHServer(t, cfg)
-
- repo, repoPath := gittest.CreateRepository(testhelper.Context(t), t, cfg, gittest.CreateRepositoryConfig{
- Seed: gittest.SeedGitLabTest,
- })
-
- localRepoPath := testhelper.TempDir(t)
-
- require.NoError(t, runClone(ctx, t, cfg, false, git.SubCmd{
- Name: "clone",
- Flags: []git.Option{
- git.Flag{Name: "--mirror"},
- },
- Args: []string{"git@localhost:test/test.git", localRepoPath},
- }, &gitalypb.SSHUploadPackRequest{
- Repository: repo,
- GitConfigOptions: []string{
- "transfer.hideRefs=refs/tags",
- },
- }))
-
- // Assert that there is at least one tag that should've been cloned if refs weren't hidden
- // as expected
- require.NotEmpty(t, gittest.Exec(t, cfg, "-C", repoPath, "tag"))
-
- // And then verify that we did indeed hide tags as expected, which is demonstrated by not
- // having fetched any tags.
- require.Empty(t, gittest.Exec(t, cfg, "-C", localRepoPath, "tag"))
-}
-
func TestUploadPackCloneFailure(t *testing.T) {
t.Parallel()