summaryrefslogtreecommitdiffstats
path: root/integrations/git_test.go
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2021-03-14 15:53:59 +0000
committerGitHub <noreply@github.com>2021-03-14 15:53:59 +0000
commit6463483ec5d441879037d43b0de24f5e92f927d0 (patch)
treeacf868e39e7154d429b9f333ca974eb680e29d39 /integrations/git_test.go
parent9566c9f0c766811883b7b4220594e78e100eca1d (diff)
downloadgitea-6463483ec5d441879037d43b0de24f5e92f927d0.tar.gz
gitea-6463483ec5d441879037d43b0de24f5e92f927d0.zip
Do not show full lfs file on error in git_test.go:rawTest() (#14980)
If there is a problem uploading to LFS it is possible for the raw endpoint to return a very large file when a pointer file is expected This will then cause the drone logs to fill up unnecessarily with the contents of the very large file. If the file returned from raw is of the incorrect size we should therefore not test it see if it contains the pointer file and just declare that it is incorrect. Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'integrations/git_test.go')
-rw-r--r--integrations/git_test.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/integrations/git_test.go b/integrations/git_test.go
index 705bd08c11..f22b1cd9f2 100644
--- a/integrations/git_test.go
+++ b/integrations/git_test.go
@@ -216,7 +216,10 @@ func rawTest(t *testing.T, ctx *APITestContext, little, big, littleLFS, bigLFS s
req = NewRequest(t, "GET", path.Join("/", username, reponame, "/raw/branch/master/", littleLFS))
resp = session.MakeRequest(t, req, http.StatusOK)
assert.NotEqual(t, littleSize, resp.Body.Len())
- assert.Contains(t, resp.Body.String(), models.LFSMetaFileIdentifier)
+ assert.LessOrEqual(t, resp.Body.Len(), 1024)
+ if resp.Body.Len() != littleSize && resp.Body.Len() <= 1024 {
+ assert.Contains(t, resp.Body.String(), models.LFSMetaFileIdentifier)
+ }
}
if !testing.Short() {
@@ -228,7 +231,9 @@ func rawTest(t *testing.T, ctx *APITestContext, little, big, littleLFS, bigLFS s
req = NewRequest(t, "GET", path.Join("/", username, reponame, "/raw/branch/master/", bigLFS))
resp = session.MakeRequest(t, req, http.StatusOK)
assert.NotEqual(t, bigSize, resp.Body.Len())
- assert.Contains(t, resp.Body.String(), models.LFSMetaFileIdentifier)
+ if resp.Body.Len() != bigSize && resp.Body.Len() <= 1024 {
+ assert.Contains(t, resp.Body.String(), models.LFSMetaFileIdentifier)
+ }
}
}
})