Skip to content
Snippets Groups Projects
Commit d4f0b942 authored by Toon Claes's avatar Toon Claes :palm_tree:
Browse files

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]: gitlab-com/gl-infra/production#7864
[2]: https://gitlab.com/GodotBuilder/godot3

Issue: #4523
parent 65806ab0
No related branches found
No related tags found
Loading
......@@ -426,6 +426,34 @@ func testInstanceStats(t *testing.T, ctx context.Context) {
"JavaScript": 1014,
},
},
{
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) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment