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>2023-03-28 16:01:17 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2023-03-28 17:04:49 +0300
commitfe6ee409c27011204da398f3037be4c5b89e3ca3 (patch)
tree38e4a71f062fbb7c6165c827e05cbd6d0bba488b
parent22f07739df92cc1cc3a0055b722c5ef63f01f3de (diff)
repository: Deseed remaining tests for GetArchive
Deseed remaining tests for GetArchive so that we can start testing with SHA256. While at it, stop skipping one of the tests when running with Praefect. The reason for skipping is that we use an intercepted command factory, which in turns breaks creating repositories via the CreateRepository RPC. But that's not true, as we only intercept calls to git-archive(1).
-rw-r--r--internal/gitaly/service/repository/archive_test.go16
1 files changed, 7 insertions, 9 deletions
diff --git a/internal/gitaly/service/repository/archive_test.go b/internal/gitaly/service/repository/archive_test.go
index 663817d72..418c23914 100644
--- a/internal/gitaly/service/repository/archive_test.go
+++ b/internal/gitaly/service/repository/archive_test.go
@@ -454,7 +454,7 @@ func TestGetArchive_pathInjection(t *testing.T) {
t.Parallel()
ctx := testhelper.Context(t)
- cfg, repo, repoPath, client := setupRepositoryService(t, ctx)
+ cfg, client := setupRepositoryServiceWithoutRepo(t)
// It used to be possible to inject options into `git-archive(1)`, with the worst outcome
// being that an adversary may create or overwrite arbitrary files in the filesystem in case
@@ -467,6 +467,7 @@ func TestGetArchive_pathInjection(t *testing.T) {
// a path and does not interpret it as an option.
outputPath := "/non/existent"
+ repo, repoPath := gittest.CreateRepository(t, ctx, cfg)
commitID := gittest.WriteCommit(t, cfg, repoPath, gittest.WithTree(gittest.WriteTree(t, cfg, repoPath, []gittest.TreeEntry{
{Path: "--output=", Mode: "040000", OID: gittest.WriteTree(t, cfg, repoPath, []gittest.TreeEntry{
{Path: "non", Mode: "040000", OID: gittest.WriteTree(t, cfg, repoPath, []gittest.TreeEntry{
@@ -503,8 +504,6 @@ func TestGetArchive_pathInjection(t *testing.T) {
func TestGetArchive_environment(t *testing.T) {
t.Parallel()
- testhelper.SkipWithPraefect(t, "It's not possible to create repositories through the API with the git command overwritten by the script.")
-
ctx := testhelper.Context(t)
cfg := testcfg.Build(t)
@@ -524,11 +523,10 @@ func TestGetArchive_environment(t *testing.T) {
client, serverSocketPath := runRepositoryService(t, cfg, nil, testserver.WithGitCommandFactory(gitCmdFactory))
cfg.SocketPath = serverSocketPath
- repo, _ := gittest.CreateRepository(t, ctx, cfg, gittest.CreateRepositoryConfig{
- Seed: gittest.SeedGitLabTest,
- })
-
- commitID := "1a0b36b3cdad1d2ee32457c102a8c0b7056fa863"
+ repo, repoPath := gittest.CreateRepository(t, ctx, cfg)
+ commitID := gittest.WriteCommit(t, cfg, repoPath, gittest.WithTreeEntries(
+ gittest.TreeEntry{Path: "some file", Mode: "100644", Content: "some content"},
+ ))
correlationID := correlation.SafeRandomID()
ctx = correlation.ContextWithCorrelation(ctx, correlationID)
@@ -568,7 +566,7 @@ func TestGetArchive_environment(t *testing.T) {
t.Run(tc.desc, func(t *testing.T) {
stream, err := client.GetArchive(ctx, &gitalypb.GetArchiveRequest{
Repository: repo,
- CommitId: commitID,
+ CommitId: commitID.String(),
IncludeLfsBlobs: tc.includeLFSBlobs,
})
require.NoError(t, err)