@@ -65,6 +65,10 @@ func testGit(t *testing.T, u *url.URL) {
65
65
little = commitAndPush (t , littleSize , dstPath )
66
66
})
67
67
t .Run ("Big" , func (t * testing.T ) {
68
+ if testing .Short () {
69
+ t .Skip ("skipping test in short mode." )
70
+ return
71
+ }
68
72
PrintCurrentTest (t )
69
73
big = commitAndPush (t , bigSize , dstPath )
70
74
})
@@ -85,10 +89,16 @@ func testGit(t *testing.T, u *url.URL) {
85
89
t .Run ("Little" , func (t * testing.T ) {
86
90
PrintCurrentTest (t )
87
91
littleLFS = commitAndPush (t , littleSize , dstPath )
92
+ lockFileTest (t , littleLFS , dstPath )
88
93
})
89
94
t .Run ("Big" , func (t * testing.T ) {
95
+ if testing .Short () {
96
+ t .Skip ("skipping test in short mode." )
97
+ return
98
+ }
90
99
PrintCurrentTest (t )
91
100
bigLFS = commitAndPush (t , bigSize , dstPath )
101
+ lockFileTest (t , bigLFS , dstPath )
92
102
})
93
103
})
94
104
t .Run ("Locks" , func (t * testing.T ) {
@@ -105,19 +115,21 @@ func testGit(t *testing.T, u *url.URL) {
105
115
resp := session .MakeRequest (t , req , http .StatusOK )
106
116
assert .Equal (t , littleSize , resp .Body .Len ())
107
117
108
- req = NewRequest (t , "GET" , path .Join ("/user2/repo-tmp-17/raw/branch/master/" , big ))
109
- nilResp := session .MakeRequestNilResponseRecorder (t , req , http .StatusOK )
110
- assert .Equal (t , bigSize , nilResp .Length )
111
-
112
118
req = NewRequest (t , "GET" , path .Join ("/user2/repo-tmp-17/raw/branch/master/" , littleLFS ))
113
119
resp = session .MakeRequest (t , req , http .StatusOK )
114
120
assert .NotEqual (t , littleSize , resp .Body .Len ())
115
121
assert .Contains (t , resp .Body .String (), models .LFSMetaFileIdentifier )
116
122
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 )
123
+ if ! testing .Short () {
124
+ req = NewRequest (t , "GET" , path .Join ("/user2/repo-tmp-17/raw/branch/master/" , big ))
125
+ nilResp := session .MakeRequestNilResponseRecorder (t , req , http .StatusOK )
126
+ assert .Equal (t , bigSize , nilResp .Length )
127
+
128
+ req = NewRequest (t , "GET" , path .Join ("/user2/repo-tmp-17/raw/branch/master/" , bigLFS ))
129
+ resp = session .MakeRequest (t , req , http .StatusOK )
130
+ assert .NotEqual (t , bigSize , resp .Body .Len ())
131
+ assert .Contains (t , resp .Body .String (), models .LFSMetaFileIdentifier )
132
+ }
121
133
122
134
})
123
135
t .Run ("Media" , func (t * testing.T ) {
@@ -129,17 +141,19 @@ func testGit(t *testing.T, u *url.URL) {
129
141
resp := session .MakeRequestNilResponseRecorder (t , req , http .StatusOK )
130
142
assert .Equal (t , littleSize , resp .Length )
131
143
132
- req = NewRequest (t , "GET" , path .Join ("/user2/repo-tmp-17/media/branch/master/" , big ))
133
- resp = session .MakeRequestNilResponseRecorder (t , req , http .StatusOK )
134
- assert .Equal (t , bigSize , resp .Length )
135
-
136
144
req = NewRequest (t , "GET" , path .Join ("/user2/repo-tmp-17/media/branch/master/" , littleLFS ))
137
145
resp = session .MakeRequestNilResponseRecorder (t , req , http .StatusOK )
138
146
assert .Equal (t , littleSize , resp .Length )
139
147
140
- req = NewRequest (t , "GET" , path .Join ("/user2/repo-tmp-17/media/branch/master/" , bigLFS ))
141
- resp = session .MakeRequestNilResponseRecorder (t , req , http .StatusOK )
142
- assert .Equal (t , bigSize , resp .Length )
148
+ if ! testing .Short () {
149
+ req = NewRequest (t , "GET" , path .Join ("/user2/repo-tmp-17/media/branch/master/" , big ))
150
+ resp = session .MakeRequestNilResponseRecorder (t , req , http .StatusOK )
151
+ assert .Equal (t , bigSize , resp .Length )
152
+
153
+ req = NewRequest (t , "GET" , path .Join ("/user2/repo-tmp-17/media/branch/master/" , bigLFS ))
154
+ resp = session .MakeRequestNilResponseRecorder (t , req , http .StatusOK )
155
+ assert .Equal (t , bigSize , resp .Length )
156
+ }
143
157
})
144
158
145
159
})
@@ -177,6 +191,10 @@ func testGit(t *testing.T, u *url.URL) {
177
191
little = commitAndPush (t , littleSize , dstPath )
178
192
})
179
193
t .Run ("Big" , func (t * testing.T ) {
194
+ if testing .Short () {
195
+ t .Skip ("skipping test in short mode." )
196
+ return
197
+ }
180
198
PrintCurrentTest (t )
181
199
big = commitAndPush (t , bigSize , dstPath )
182
200
})
@@ -197,10 +215,17 @@ func testGit(t *testing.T, u *url.URL) {
197
215
t .Run ("Little" , func (t * testing.T ) {
198
216
PrintCurrentTest (t )
199
217
littleLFS = commitAndPush (t , littleSize , dstPath )
218
+ lockFileTest (t , littleLFS , dstPath )
219
+
200
220
})
201
221
t .Run ("Big" , func (t * testing.T ) {
222
+ if testing .Short () {
223
+ return
224
+ }
202
225
PrintCurrentTest (t )
203
226
bigLFS = commitAndPush (t , bigSize , dstPath )
227
+ lockFileTest (t , bigLFS , dstPath )
228
+
204
229
})
205
230
})
206
231
t .Run ("Locks" , func (t * testing.T ) {
@@ -217,20 +242,21 @@ func testGit(t *testing.T, u *url.URL) {
217
242
resp := session .MakeRequest (t , req , http .StatusOK )
218
243
assert .Equal (t , littleSize , resp .Body .Len ())
219
244
220
- req = NewRequest (t , "GET" , path .Join ("/user2/repo-tmp-18/raw/branch/master/" , big ))
221
- resp = session .MakeRequest (t , req , http .StatusOK )
222
- assert .Equal (t , bigSize , resp .Body .Len ())
223
-
224
245
req = NewRequest (t , "GET" , path .Join ("/user2/repo-tmp-18/raw/branch/master/" , littleLFS ))
225
246
resp = session .MakeRequest (t , req , http .StatusOK )
226
247
assert .NotEqual (t , littleSize , resp .Body .Len ())
227
248
assert .Contains (t , resp .Body .String (), models .LFSMetaFileIdentifier )
228
249
229
- req = NewRequest ( t , "GET" , path . Join ( "/user2/repo-tmp-18/raw/branch/master/" , bigLFS ))
230
- resp = session . MakeRequest (t , req , http . StatusOK )
231
- assert . NotEqual (t , bigSize , resp . Body . Len () )
232
- assert .Contains (t , resp .Body .String (), models . LFSMetaFileIdentifier )
250
+ if ! testing . Short () {
251
+ req = NewRequest (t , "GET" , path . Join ( "/user2/repo-tmp-18/raw/branch/master/" , big ) )
252
+ resp = session . MakeRequest (t , req , http . StatusOK )
253
+ assert .Equal (t , bigSize , resp .Body .Len () )
233
254
255
+ req = NewRequest (t , "GET" , path .Join ("/user2/repo-tmp-18/raw/branch/master/" , bigLFS ))
256
+ resp = session .MakeRequest (t , req , http .StatusOK )
257
+ assert .NotEqual (t , bigSize , resp .Body .Len ())
258
+ assert .Contains (t , resp .Body .String (), models .LFSMetaFileIdentifier )
259
+ }
234
260
})
235
261
t .Run ("Media" , func (t * testing.T ) {
236
262
PrintCurrentTest (t )
@@ -241,17 +267,19 @@ func testGit(t *testing.T, u *url.URL) {
241
267
resp := session .MakeRequest (t , req , http .StatusOK )
242
268
assert .Equal (t , littleSize , resp .Body .Len ())
243
269
244
- req = NewRequest (t , "GET" , path .Join ("/user2/repo-tmp-18/media/branch/master/" , big ))
245
- resp = session .MakeRequest (t , req , http .StatusOK )
246
- assert .Equal (t , bigSize , resp .Body .Len ())
247
-
248
270
req = NewRequest (t , "GET" , path .Join ("/user2/repo-tmp-18/media/branch/master/" , littleLFS ))
249
271
resp = session .MakeRequest (t , req , http .StatusOK )
250
272
assert .Equal (t , littleSize , resp .Body .Len ())
251
273
252
- req = NewRequest (t , "GET" , path .Join ("/user2/repo-tmp-18/media/branch/master/" , bigLFS ))
253
- resp = session .MakeRequest (t , req , http .StatusOK )
254
- assert .Equal (t , bigSize , resp .Body .Len ())
274
+ if ! testing .Short () {
275
+ req = NewRequest (t , "GET" , path .Join ("/user2/repo-tmp-18/media/branch/master/" , big ))
276
+ resp = session .MakeRequest (t , req , http .StatusOK )
277
+ assert .Equal (t , bigSize , resp .Body .Len ())
278
+
279
+ req = NewRequest (t , "GET" , path .Join ("/user2/repo-tmp-18/media/branch/master/" , bigLFS ))
280
+ resp = session .MakeRequest (t , req , http .StatusOK )
281
+ assert .Equal (t , bigSize , resp .Body .Len ())
282
+ }
255
283
})
256
284
257
285
})
@@ -268,15 +296,17 @@ func ensureAnonymousClone(t *testing.T, u *url.URL) {
268
296
}
269
297
270
298
func lockTest (t * testing.T , remote , repoPath string ) {
271
- _ , err := git .NewCommand ("remote" ).AddArguments ("set-url" , "origin" , remote ).RunInDir (repoPath ) //TODO add test ssh git-lfs-creds
272
- assert .NoError (t , err )
273
- _ , err = git .NewCommand ("lfs" ).AddArguments ("locks" ).RunInDir (repoPath )
299
+ lockFileTest (t , "README.md" , repoPath )
300
+ }
301
+
302
+ func lockFileTest (t * testing.T , filename , repoPath string ) {
303
+ _ , err := git .NewCommand ("lfs" ).AddArguments ("locks" ).RunInDir (repoPath )
274
304
assert .NoError (t , err )
275
- _ , err = git .NewCommand ("lfs" ).AddArguments ("lock" , "README.md" ).RunInDir (repoPath )
305
+ _ , err = git .NewCommand ("lfs" ).AddArguments ("lock" , filename ).RunInDir (repoPath )
276
306
assert .NoError (t , err )
277
307
_ , err = git .NewCommand ("lfs" ).AddArguments ("locks" ).RunInDir (repoPath )
278
308
assert .NoError (t , err )
279
- _ , err = git .NewCommand ("lfs" ).AddArguments ("unlock" , "README.md" ).RunInDir (repoPath )
309
+ _ , err = git .NewCommand ("lfs" ).AddArguments ("unlock" , filename ).RunInDir (repoPath )
280
310
assert .NoError (t , err )
281
311
}
282
312
0 commit comments