Fix: capacity should be returned back when put failed

This commit is contained in:
HFO4
2020-01-25 10:40:53 +08:00
parent 8d437a451c
commit dc32e85492
8 changed files with 47 additions and 16 deletions

View File

@@ -388,7 +388,7 @@ func TestClient_UploadChunk(t *testing.T) {
ChunkSize: 10,
Total: 100,
Retried: 0,
Reader: strings.NewReader("1231312"),
Data: strings.NewReader("1231312"),
})
clientMock.AssertExpectations(t)
asserts.NoError(err)
@@ -418,7 +418,7 @@ func TestClient_UploadChunk(t *testing.T) {
ChunkSize: 10,
Total: 100,
Retried: 0,
Reader: strings.NewReader("1231312"),
Data: strings.NewReader("1231312"),
})
clientMock.AssertExpectations(t)
asserts.Error(err)
@@ -448,7 +448,7 @@ func TestClient_UploadChunk(t *testing.T) {
ChunkSize: 5,
Total: 100,
Retried: 0,
Reader: strings.NewReader("1231312"),
Data: strings.NewReader("1231312"),
})
clientMock.AssertExpectations(t)
asserts.NoError(err)
@@ -483,7 +483,7 @@ func TestClient_UploadChunk(t *testing.T) {
ChunkSize: 5,
Total: 100,
Retried: 0,
Reader: strings.NewReader("1231312"),
Data: strings.NewReader("1231312"),
}
res, err := client.UploadChunk(context.Background(), "http://dev.com", chunk)
clientMock.AssertExpectations(t)