@@ -61,6 +61,10 @@ func testGit(t *testing.T, u *url.URL) {
6161 little = commitAndPush (t , littleSize , dstPath )
6262 })
6363 t .Run ("Big" , func (t * testing.T ) {
64+ if testing .Short () {
65+ t .Skip ("skipping test in short mode." )
66+ return
67+ }
6468 big = commitAndPush (t , bigSize , dstPath )
6569 })
6670 })
@@ -77,9 +81,15 @@ func testGit(t *testing.T, u *url.URL) {
7781
7882 t .Run ("Little" , func (t * testing.T ) {
7983 littleLFS = commitAndPush (t , littleSize , dstPath )
84+ lockFileTest (t , littleLFS , dstPath )
8085 })
8186 t .Run ("Big" , func (t * testing.T ) {
87+ if testing .Short () {
88+ t .Skip ("skipping test in short mode." )
89+ return
90+ }
8291 bigLFS = commitAndPush (t , bigSize , dstPath )
92+ lockFileTest (t , bigLFS , dstPath )
8393 })
8494 })
8595 t .Run ("Locks" , func (t * testing.T ) {
@@ -94,19 +104,21 @@ func testGit(t *testing.T, u *url.URL) {
94104 resp := session .MakeRequest (t , req , http .StatusOK )
95105 assert .Equal (t , littleSize , resp .Body .Len ())
96106
97- req = NewRequest (t , "GET" , path .Join ("/user2/repo-tmp-17/raw/branch/master/" , big ))
98- nilResp := session .MakeRequestNilResponseRecorder (t , req , http .StatusOK )
99- assert .Equal (t , bigSize , nilResp .Length )
100-
101107 req = NewRequest (t , "GET" , path .Join ("/user2/repo-tmp-17/raw/branch/master/" , littleLFS ))
102108 resp = session .MakeRequest (t , req , http .StatusOK )
103109 assert .NotEqual (t , littleSize , resp .Body .Len ())
104110 assert .Contains (t , resp .Body .String (), models .LFSMetaFileIdentifier )
105111
106- req = NewRequest (t , "GET" , path .Join ("/user2/repo-tmp-17/raw/branch/master/" , bigLFS ))
107- resp = session .MakeRequest (t , req , http .StatusOK )
108- assert .NotEqual (t , bigSize , resp .Body .Len ())
109- assert .Contains (t , resp .Body .String (), models .LFSMetaFileIdentifier )
112+ if ! testing .Short () {
113+ req = NewRequest (t , "GET" , path .Join ("/user2/repo-tmp-17/raw/branch/master/" , big ))
114+ nilResp := session .MakeRequestNilResponseRecorder (t , req , http .StatusOK )
115+ assert .Equal (t , bigSize , nilResp .Length )
116+
117+ req = NewRequest (t , "GET" , path .Join ("/user2/repo-tmp-17/raw/branch/master/" , bigLFS ))
118+ resp = session .MakeRequest (t , req , http .StatusOK )
119+ assert .NotEqual (t , bigSize , resp .Body .Len ())
120+ assert .Contains (t , resp .Body .String (), models .LFSMetaFileIdentifier )
121+ }
110122
111123 })
112124 t .Run ("Media" , func (t * testing.T ) {
@@ -117,17 +129,19 @@ func testGit(t *testing.T, u *url.URL) {
117129 resp := session .MakeRequestNilResponseRecorder (t , req , http .StatusOK )
118130 assert .Equal (t , littleSize , resp .Length )
119131
120- req = NewRequest (t , "GET" , path .Join ("/user2/repo-tmp-17/media/branch/master/" , big ))
121- resp = session .MakeRequestNilResponseRecorder (t , req , http .StatusOK )
122- assert .Equal (t , bigSize , resp .Length )
123-
124132 req = NewRequest (t , "GET" , path .Join ("/user2/repo-tmp-17/media/branch/master/" , littleLFS ))
125133 resp = session .MakeRequestNilResponseRecorder (t , req , http .StatusOK )
126134 assert .Equal (t , littleSize , resp .Length )
127135
128- req = NewRequest (t , "GET" , path .Join ("/user2/repo-tmp-17/media/branch/master/" , bigLFS ))
129- resp = session .MakeRequestNilResponseRecorder (t , req , http .StatusOK )
130- assert .Equal (t , bigSize , resp .Length )
136+ if ! testing .Short () {
137+ req = NewRequest (t , "GET" , path .Join ("/user2/repo-tmp-17/media/branch/master/" , big ))
138+ resp = session .MakeRequestNilResponseRecorder (t , req , http .StatusOK )
139+ assert .Equal (t , bigSize , resp .Length )
140+
141+ req = NewRequest (t , "GET" , path .Join ("/user2/repo-tmp-17/media/branch/master/" , bigLFS ))
142+ resp = session .MakeRequestNilResponseRecorder (t , req , http .StatusOK )
143+ assert .Equal (t , bigSize , resp .Length )
144+ }
131145 })
132146
133147 })
@@ -160,6 +174,10 @@ func testGit(t *testing.T, u *url.URL) {
160174 little = commitAndPush (t , littleSize , dstPath )
161175 })
162176 t .Run ("Big" , func (t * testing.T ) {
177+ if testing .Short () {
178+ t .Skip ("skipping test in short mode." )
179+ return
180+ }
163181 big = commitAndPush (t , bigSize , dstPath )
164182 })
165183 })
@@ -176,9 +194,16 @@ func testGit(t *testing.T, u *url.URL) {
176194
177195 t .Run ("Little" , func (t * testing.T ) {
178196 littleLFS = commitAndPush (t , littleSize , dstPath )
197+ lockFileTest (t , littleLFS , dstPath )
198+
179199 })
180200 t .Run ("Big" , func (t * testing.T ) {
201+ if testing .Short () {
202+ return
203+ }
181204 bigLFS = commitAndPush (t , bigSize , dstPath )
205+ lockFileTest (t , bigLFS , dstPath )
206+
182207 })
183208 })
184209 t .Run ("Locks" , func (t * testing.T ) {
@@ -193,20 +218,21 @@ func testGit(t *testing.T, u *url.URL) {
193218 resp := session .MakeRequest (t , req , http .StatusOK )
194219 assert .Equal (t , littleSize , resp .Body .Len ())
195220
196- req = NewRequest (t , "GET" , path .Join ("/user2/repo-tmp-18/raw/branch/master/" , big ))
197- resp = session .MakeRequest (t , req , http .StatusOK )
198- assert .Equal (t , bigSize , resp .Body .Len ())
199-
200221 req = NewRequest (t , "GET" , path .Join ("/user2/repo-tmp-18/raw/branch/master/" , littleLFS ))
201222 resp = session .MakeRequest (t , req , http .StatusOK )
202223 assert .NotEqual (t , littleSize , resp .Body .Len ())
203224 assert .Contains (t , resp .Body .String (), models .LFSMetaFileIdentifier )
204225
205- req = NewRequest ( t , "GET" , path . Join ( "/user2/repo-tmp-18/raw/branch/master/" , bigLFS ))
206- resp = session . MakeRequest (t , req , http . StatusOK )
207- assert . NotEqual (t , bigSize , resp . Body . Len () )
208- assert .Contains (t , resp .Body .String (), models . LFSMetaFileIdentifier )
226+ if ! testing . Short () {
227+ req = NewRequest (t , "GET" , path . Join ( "/user2/repo-tmp-18/raw/branch/master/" , big ) )
228+ resp = session . MakeRequest (t , req , http . StatusOK )
229+ assert .Equal (t , bigSize , resp .Body .Len () )
209230
231+ req = NewRequest (t , "GET" , path .Join ("/user2/repo-tmp-18/raw/branch/master/" , bigLFS ))
232+ resp = session .MakeRequest (t , req , http .StatusOK )
233+ assert .NotEqual (t , bigSize , resp .Body .Len ())
234+ assert .Contains (t , resp .Body .String (), models .LFSMetaFileIdentifier )
235+ }
210236 })
211237 t .Run ("Media" , func (t * testing.T ) {
212238 session := loginUser (t , "user2" )
@@ -216,17 +242,19 @@ func testGit(t *testing.T, u *url.URL) {
216242 resp := session .MakeRequest (t , req , http .StatusOK )
217243 assert .Equal (t , littleSize , resp .Body .Len ())
218244
219- req = NewRequest (t , "GET" , path .Join ("/user2/repo-tmp-18/media/branch/master/" , big ))
220- resp = session .MakeRequest (t , req , http .StatusOK )
221- assert .Equal (t , bigSize , resp .Body .Len ())
222-
223245 req = NewRequest (t , "GET" , path .Join ("/user2/repo-tmp-18/media/branch/master/" , littleLFS ))
224246 resp = session .MakeRequest (t , req , http .StatusOK )
225247 assert .Equal (t , littleSize , resp .Body .Len ())
226248
227- req = NewRequest (t , "GET" , path .Join ("/user2/repo-tmp-18/media/branch/master/" , bigLFS ))
228- resp = session .MakeRequest (t , req , http .StatusOK )
229- assert .Equal (t , bigSize , resp .Body .Len ())
249+ if ! testing .Short () {
250+ req = NewRequest (t , "GET" , path .Join ("/user2/repo-tmp-18/media/branch/master/" , big ))
251+ resp = session .MakeRequest (t , req , http .StatusOK )
252+ assert .Equal (t , bigSize , resp .Body .Len ())
253+
254+ req = NewRequest (t , "GET" , path .Join ("/user2/repo-tmp-18/media/branch/master/" , bigLFS ))
255+ resp = session .MakeRequest (t , req , http .StatusOK )
256+ assert .Equal (t , bigSize , resp .Body .Len ())
257+ }
230258 })
231259
232260 })
@@ -243,15 +271,17 @@ func ensureAnonymousClone(t *testing.T, u *url.URL) {
243271}
244272
245273func lockTest (t * testing.T , remote , repoPath string ) {
246- _ , err := git .NewCommand ("remote" ).AddArguments ("set-url" , "origin" , remote ).RunInDir (repoPath ) //TODO add test ssh git-lfs-creds
247- assert .NoError (t , err )
248- _ , err = git .NewCommand ("lfs" ).AddArguments ("locks" ).RunInDir (repoPath )
274+ lockFileTest (t , "README.md" , repoPath )
275+ }
276+
277+ func lockFileTest (t * testing.T , filename , repoPath string ) {
278+ _ , err := git .NewCommand ("lfs" ).AddArguments ("locks" ).RunInDir (repoPath )
249279 assert .NoError (t , err )
250- _ , err = git .NewCommand ("lfs" ).AddArguments ("lock" , "README.md" ).RunInDir (repoPath )
280+ _ , err = git .NewCommand ("lfs" ).AddArguments ("lock" , filename ).RunInDir (repoPath )
251281 assert .NoError (t , err )
252282 _ , err = git .NewCommand ("lfs" ).AddArguments ("locks" ).RunInDir (repoPath )
253283 assert .NoError (t , err )
254- _ , err = git .NewCommand ("lfs" ).AddArguments ("unlock" , "README.md" ).RunInDir (repoPath )
284+ _ , err = git .NewCommand ("lfs" ).AddArguments ("unlock" , filename ).RunInDir (repoPath )
255285 assert .NoError (t , err )
256286}
257287
0 commit comments