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:
authorToon Claes <toon@gitlab.com>2022-10-12 17:15:16 +0300
committerToon Claes <toon@gitlab.com>2022-10-21 12:01:18 +0300
commit54e5fde7d86694acc3978000319725f977583d50 (patch)
tree51deafa9b58e2083917952eb325f398860a8f749
parentadad8efbc270ba08c1ada2e91809eee2793a5c1f (diff)
linguist: Add test case that was causing crash
We've seen Gitaly crash in production [1]. This change adds a test case emulating the crash so we know the changes in previous commits fixes it. The crash originally happened on [2]. [1]: https://gitlab.com/gitlab-com/gl-infra/production/-/issues/7864 [2]: https://gitlab.com/GodotBuilder/godot3 Issue: https://gitlab.com/gitlab-org/gitaly/-/issues/4523
-rw-r--r--internal/gitaly/linguist/linguist_test.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/internal/gitaly/linguist/linguist_test.go b/internal/gitaly/linguist/linguist_test.go
index c74e1a479..5498126f4 100644
--- a/internal/gitaly/linguist/linguist_test.go
+++ b/internal/gitaly/linguist/linguist_test.go
@@ -427,6 +427,34 @@ func testInstanceStats(t *testing.T, ctx context.Context) {
},
},
{
+ desc: "buggy behavior",
+ setup: func(t *testing.T) (*gitalypb.Repository, string, git.ObjectID) {
+ repoProto, repoPath := gittest.CreateRepository(t, ctx, cfg, gittest.CreateRepositoryConfig{
+ SkipCreationViaService: true,
+ })
+
+ includeTree := gittest.WriteTree(t, cfg, repoPath, []gittest.TreeEntry{
+ {Path: "ffx_a.h", Mode: "100644", Content: "#include <stdio.h>\n"},
+ })
+ thirdPartyTree := gittest.WriteTree(t, cfg, repoPath, []gittest.TreeEntry{
+ {Path: "ffx_a.c", Mode: "100644", Content: "#include <include/ffx_a.h>\nstatic int something() {}"},
+ {Path: "include", Mode: "040000", OID: includeTree},
+ })
+
+ commitID := gittest.WriteCommit(t, cfg, repoPath, gittest.WithTreeEntries(
+ gittest.TreeEntry{Path: "thirdparty", Mode: "040000", OID: thirdPartyTree},
+ gittest.TreeEntry{
+ Path: ".gitattributes",
+ Mode: "100644",
+ Content: "*.h linguist-language=cpp\nthirdparty/* linguist-vendored",
+ },
+ ))
+
+ return repoProto, repoPath, commitID
+ },
+ expectedStats: ByteCountPerLanguage{},
+ },
+ {
desc: "corrupted cache",
setup: func(t *testing.T) (*gitalypb.Repository, string, git.ObjectID) {
repoProto, repoPath := gittest.CreateRepository(t, ctx, cfg, gittest.CreateRepositoryConfig{