Skip to content

Commit 7158bb2

Browse files
authored
Merge pull request #55 from SpectraLogic/content_length_fix
Removing dependency on core module from integration test
2 parents 87f8361 + 4477220 commit 7158bb2

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

ds3_integration/nilReadSizer.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Copyright 2014-2018 Spectra Logic Corporation. All Rights Reserved.
2+
// Licensed under the Apache License, Version 2.0 (the "License"). You may not use
3+
// this file except in compliance with the License. A copy of the License is located at
4+
//
5+
// http://www.apache.org/licenses/LICENSE-2.0
6+
//
7+
// or in the "license" file accompanying this file.
8+
// This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
9+
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
10+
// specific language governing permissions and limitations under the License.
11+
12+
package ds3_integration
13+
14+
import "io"
15+
16+
type nilReadSizer struct {
17+
reader io.Reader
18+
fileSize int64
19+
}
20+
21+
func newNilReadSizer(reader io.Reader, fileSize int64) nilReadSizer {
22+
return nilReadSizer { reader: reader, fileSize: fileSize }
23+
}
24+
25+
func (readSizer *nilReadSizer) Read(p []byte) (n int, err error) {
26+
return readSizer.reader.Read(p)
27+
}
28+
29+
func (readSizer *nilReadSizer) Size() (int64, error) {
30+
return readSizer.fileSize, nil
31+
}

ds3_integration/smoke_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
"bytes"
2323
"spectra/ds3_go_sdk/ds3_utils/ds3Testing"
2424
"strconv"
25-
"spectra/core/ioutils"
2625
)
2726

2827
var client *ds3.Client
@@ -481,7 +480,7 @@ func TestPuttingFolder(t *testing.T) {
481480

482481
const folderPath = "Gracie/Eskimo/"
483482

484-
readSizer := ioutils.NewReadSizer(nil, 0)
483+
readSizer := newNilReadSizer(nil, 0)
485484
putObjectRequest := models.NewPutObjectRequest(bucketName, folderPath, &readSizer)
486485
_, err = client.PutObject(putObjectRequest)
487486
ds3Testing.AssertNilError(t, err)

0 commit comments

Comments
 (0)