@@ -61,6 +61,10 @@ func testGit(t *testing.T, u *url.URL) {
61
61
little = commitAndPush (t , littleSize , dstPath )
62
62
})
63
63
t .Run ("Big" , func (t * testing.T ) {
64
+ if testing .Short () {
65
+ t .Skip ("skipping test in short mode." )
66
+ return
67
+ }
64
68
big = commitAndPush (t , bigSize , dstPath )
65
69
})
66
70
})
@@ -77,9 +81,15 @@ func testGit(t *testing.T, u *url.URL) {
77
81
78
82
t .Run ("Little" , func (t * testing.T ) {
79
83
littleLFS = commitAndPush (t , littleSize , dstPath )
84
+ lockFileTest (t , littleLFS , dstPath )
80
85
})
81
86
t .Run ("Big" , func (t * testing.T ) {
87
+ if testing .Short () {
88
+ t .Skip ("skipping test in short mode." )
89
+ return
90
+ }
82
91
bigLFS = commitAndPush (t , bigSize , dstPath )
92
+ lockFileTest (t , bigLFS , dstPath )
83
93
})
84
94
})
85
95
t .Run ("Locks" , func (t * testing.T ) {
@@ -94,19 +104,21 @@ func testGit(t *testing.T, u *url.URL) {
94
104
resp := session .MakeRequest (t , req , http .StatusOK )
95
105
assert .Equal (t , littleSize , resp .Body .Len ())
96
106
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
-
101
107
req = NewRequest (t , "GET" , path .Join ("/user2/repo-tmp-17/raw/branch/master/" , littleLFS ))
102
108
resp = session .MakeRequest (t , req , http .StatusOK )
103
109
assert .NotEqual (t , littleSize , resp .Body .Len ())
104
110
assert .Contains (t , resp .Body .String (), models .LFSMetaFileIdentifier )
105
111
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
+ }
110
122
111
123
})
112
124
t .Run ("Media" , func (t * testing.T ) {
@@ -117,17 +129,19 @@ func testGit(t *testing.T, u *url.URL) {
117
129
resp := session .MakeRequestNilResponseRecorder (t , req , http .StatusOK )
118
130
assert .Equal (t , littleSize , resp .Length )
119
131
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
-
124
132
req = NewRequest (t , "GET" , path .Join ("/user2/repo-tmp-17/media/branch/master/" , littleLFS ))
125
133
resp = session .MakeRequestNilResponseRecorder (t , req , http .StatusOK )
126
134
assert .Equal (t , littleSize , resp .Length )
127
135
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
+ }
131
145
})
132
146
133
147
})
@@ -160,6 +174,10 @@ func testGit(t *testing.T, u *url.URL) {
160
174
little = commitAndPush (t , littleSize , dstPath )
161
175
})
162
176
t .Run ("Big" , func (t * testing.T ) {
177
+ if testing .Short () {
178
+ t .Skip ("skipping test in short mode." )
179
+ return
180
+ }
163
181
big = commitAndPush (t , bigSize , dstPath )
164
182
})
165
183
})
@@ -176,9 +194,16 @@ func testGit(t *testing.T, u *url.URL) {
176
194
177
195
t .Run ("Little" , func (t * testing.T ) {
178
196
littleLFS = commitAndPush (t , littleSize , dstPath )
197
+ lockFileTest (t , littleLFS , dstPath )
198
+
179
199
})
180
200
t .Run ("Big" , func (t * testing.T ) {
201
+ if testing .Short () {
202
+ return
203
+ }
181
204
bigLFS = commitAndPush (t , bigSize , dstPath )
205
+ lockFileTest (t , bigLFS , dstPath )
206
+
182
207
})
183
208
})
184
209
t .Run ("Locks" , func (t * testing.T ) {
@@ -193,20 +218,21 @@ func testGit(t *testing.T, u *url.URL) {
193
218
resp := session .MakeRequest (t , req , http .StatusOK )
194
219
assert .Equal (t , littleSize , resp .Body .Len ())
195
220
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
-
200
221
req = NewRequest (t , "GET" , path .Join ("/user2/repo-tmp-18/raw/branch/master/" , littleLFS ))
201
222
resp = session .MakeRequest (t , req , http .StatusOK )
202
223
assert .NotEqual (t , littleSize , resp .Body .Len ())
203
224
assert .Contains (t , resp .Body .String (), models .LFSMetaFileIdentifier )
204
225
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 () )
209
230
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
+ }
210
236
})
211
237
t .Run ("Media" , func (t * testing.T ) {
212
238
session := loginUser (t , "user2" )
@@ -216,17 +242,19 @@ func testGit(t *testing.T, u *url.URL) {
216
242
resp := session .MakeRequest (t , req , http .StatusOK )
217
243
assert .Equal (t , littleSize , resp .Body .Len ())
218
244
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
-
223
245
req = NewRequest (t , "GET" , path .Join ("/user2/repo-tmp-18/media/branch/master/" , littleLFS ))
224
246
resp = session .MakeRequest (t , req , http .StatusOK )
225
247
assert .Equal (t , littleSize , resp .Body .Len ())
226
248
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
+ }
230
258
})
231
259
232
260
})
@@ -243,15 +271,17 @@ func ensureAnonymousClone(t *testing.T, u *url.URL) {
243
271
}
244
272
245
273
func 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 )
249
279
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 )
251
281
assert .NoError (t , err )
252
282
_ , err = git .NewCommand ("lfs" ).AddArguments ("locks" ).RunInDir (repoPath )
253
283
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 )
255
285
assert .NoError (t , err )
256
286
}
257
287
0 commit comments