@@ -12,7 +12,7 @@ import (
12
12
var test02Push = func () {
13
13
g .Context (titlePush , func () {
14
14
15
- var lastResponse * reggie.Response
15
+ var lastResponse , prevResponse * reggie.Response
16
16
17
17
g .Context ("Setup" , func () {
18
18
// No setup required at this time for push tests
@@ -175,6 +175,7 @@ var test02Push = func() {
175
175
Expect (err ).To (BeNil ())
176
176
location := resp .Header ().Get ("Location" )
177
177
Expect (location ).ToNot (BeEmpty ())
178
+ prevResponse = resp
178
179
179
180
req = client .NewRequest (reggie .PATCH , resp .GetRelativeLocation ()).
180
181
SetHeader ("Content-Type" , "application/octet-stream" ).
@@ -184,6 +185,30 @@ var test02Push = func() {
184
185
resp , err = client .Do (req )
185
186
Expect (err ).To (BeNil ())
186
187
Expect (resp .StatusCode ()).To (Equal (http .StatusAccepted ))
188
+ Expect (resp .Header ().Get ("Range" )).To (Equal (testBlobBChunk1Range ))
189
+ lastResponse = resp
190
+ })
191
+
192
+ g .Specify ("Retry previous blob chunk should return 416" , func () {
193
+ SkipIfDisabled (push )
194
+ req := client .NewRequest (reggie .PATCH , prevResponse .GetRelativeLocation ()).
195
+ SetHeader ("Content-Type" , "application/octet-stream" ).
196
+ SetHeader ("Content-Length" , testBlobBChunk1Length ).
197
+ SetHeader ("Content-Range" , testBlobBChunk1Range ).
198
+ SetBody (testBlobBChunk1 )
199
+ resp , err := client .Do (req )
200
+ Expect (err ).To (BeNil ())
201
+ Expect (resp .StatusCode ()).To (Equal (http .StatusRequestedRangeNotSatisfiable ))
202
+ })
203
+
204
+ g .Specify ("Get on stale blob upload should return 204 with a range and location" , func () {
205
+ SkipIfDisabled (push )
206
+ req := client .NewRequest (reggie .GET , prevResponse .GetRelativeLocation ())
207
+ resp , err := client .Do (req )
208
+ Expect (err ).To (BeNil ())
209
+ Expect (resp .StatusCode ()).To (Equal (http .StatusNoContent ))
210
+ Expect (resp .Header ().Get ("Location" )).ToNot (BeEmpty ())
211
+ Expect (resp .Header ().Get ("Range" )).To (Equal (fmt .Sprintf ("bytes=%s" , testBlobBChunk1Range )))
187
212
lastResponse = resp
188
213
})
189
214
0 commit comments