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 15:04:33 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2022-06-15 08:55:30 +0300
commit236fd1acfa12016768602f651dc3bcaf83c51395 (patch)
tree8305f83c5ebc891b8fff143f90c2414d21ec9da4
parent348aff19d79a6045c170d94541165db1dd975e04 (diff)
ssh: Fix test setup not actually exercising clone failure
One of our tests that ought to verify whether cloning fails when we pass an invalid repository only checked that an error was returned, but it never checked what kind of error was returned. And sure enough, nowadays we don't fail because of an invalid request, but because the test setup is incomplete and missing the `gitaly-ssh` binary. Fix the test setup to build this binary and verify that the error matches what we expect so we don't regress again in the future.
-rw-r--r--internal/gitaly/service/ssh/upload_pack_test.go15
1 files changed, 12 insertions, 3 deletions
diff --git a/internal/gitaly/service/ssh/upload_pack_test.go b/internal/gitaly/service/ssh/upload_pack_test.go
index 43adab207..bfccd57e4 100644
--- a/internal/gitaly/service/ssh/upload_pack_test.go
+++ b/internal/gitaly/service/ssh/upload_pack_test.go
@@ -467,9 +467,10 @@ func TestUploadPackCloneFailure(t *testing.T) {
ctx := testhelper.Context(t)
cfg := testcfg.Build(t)
-
cfg.SocketPath = runSSHServer(t, cfg)
+ testcfg.BuildGitalySSH(t, cfg)
+
repo, _ := gittest.CreateRepository(testhelper.Context(t), t, cfg, gittest.CreateRepositoryConfig{
Seed: gittest.SeedGitLabTest,
})
@@ -478,14 +479,22 @@ func TestUploadPackCloneFailure(t *testing.T) {
err := runClone(ctx, t, cfg, false, git.SubCmd{
Name: "clone",
- Args: []string{"git@localhost:test/test.git", localRepoPath},
+ Args: []string{
+ "git@localhost:test/test.git", localRepoPath,
+ },
}, &gitalypb.SSHUploadPackRequest{
Repository: &gitalypb.Repository{
StorageName: "foobar",
RelativePath: repo.GetRelativePath(),
},
})
- require.Error(t, err, "clone didn't fail")
+ require.Error(t, err)
+
+ if testhelper.IsPraefectEnabled() {
+ require.Contains(t, err.Error(), "rpc error: code = InvalidArgument desc = repo scoped: invalid Repository")
+ } else {
+ require.Contains(t, err.Error(), "rpc error: code = InvalidArgument desc = GetStorageByName: no such storage: \\\"foobar\\\"")
+ }
}
func TestUploadPack_gitFailure(t *testing.T) {