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-12 17:21:04 +0300
commitdc9775467dd2c944915e62edcf4b72a2d2e872fa (patch)
tree5a7e0fd90df5357ff7bc9a568ba3f1931df15c7e
parente29f8f7ad0dc0924441448d35425bf3996d28131 (diff)
linguist: Add test case causing crashtoon-linguist-crash-no-more
I've seen Gitaly crash in production [1]. This change adds a test case emulating the crash so we can fix 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 5d0ae925e..6ac60fe55 100644
--- a/internal/gitaly/linguist/linguist_test.go
+++ b/internal/gitaly/linguist/linguist_test.go
@@ -426,6 +426,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(ctx, t, cfg, gittest.CreateRepositoryConfig{
+ SkipCreationViaService: true,
+ })
+
+ amdTree := gittest.WriteTree(t, cfg, repoPath, []gittest.TreeEntry{
+ {Path: "ffx_a.h", Mode: "100644", Content: strings.Repeat("a", 349)},
+ })
+ thirdPartyTree := gittest.WriteTree(t, cfg, repoPath, []gittest.TreeEntry{
+ {Path: "README.md", Mode: "100644", Content: strings.Repeat("a", 234)},
+ {Path: "amd-fsr", Mode: "040000", OID: amdTree},
+ })
+
+ 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(ctx, t, cfg, gittest.CreateRepositoryConfig{