Skip to content

Commit

Permalink
Merge pull request goamz#1 from goamz/fixtests
Browse files Browse the repository at this point in the history
Fix tests & S3
  • Loading branch information
mattheath committed Apr 2, 2014
2 parents 862ba58 + 51ed81f commit ff3d9a6
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ before_script:
- FIXED=$(go fmt ./... | wc -l); if [ $FIXED -gt 0 ]; then echo "gofmt - $FIXED file(s) not formatted correctly, please run gofmt to fix this." && exit 1; fi

script:
- go test -v ./autoscaling/
- go test -v ./aws/
- go test -v ./cloudfront/
- go test -v ./cloudwatch/
- go test -v ./dynamodb/
- go test -v ./ec2/
- go test -v ./elb/
- go test -v ./iam/
- go test -v ./rds/
- go test -v ./route53/
- go test -v ./s3/
- go test -v ./sqs/
- go test -v ./autoscaling/
- go test -v ./rds/
2 changes: 1 addition & 1 deletion rds/rds.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"strconv"
)

const debug = true
const debug = false

const (
ServiceName = "rds"
Expand Down
10 changes: 7 additions & 3 deletions s3/responses_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ package s3_test

var GetObjectErrorDump = `
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>NoSuchBucket</Code><Message>The specified bucket does not exist</Message>
<BucketName>non-existent-bucket</BucketName><RequestId>3F1B667FAD71C3D8</RequestId>
<HostId>L4ee/zrm1irFXY5F45fKXIRdOf9ktsKY/8TDVawuMK2jWRb1RF84i1uBzkdNqS5D</HostId></Error>
<Error>
<Code>NoSuchBucket</Code>
<Message>The specified bucket does not exist</Message>
<BucketName>non-existent-bucket</BucketName>
<RequestId>3F1B667FAD71C3D8</RequestId>
<HostId>L4ee/zrm1irFXY5F45fKXIRdOf9ktsKY/8TDVawuMK2jWRb1RF84i1uBzkdNqS5D</HostId>
</Error>
`

var GetListResultDump1 = `
Expand Down
8 changes: 6 additions & 2 deletions s3/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,15 @@ func (b *Bucket) DelBucket() (err error) {
// See http://goo.gl/isCO7 for details.
func (b *Bucket) Get(path string) (data []byte, err error) {
body, err := b.GetReader(path)
defer func() {
if body != nil {
body.Close()
}
}()
if err != nil {
return nil, err
}
data, err = ioutil.ReadAll(body)
body.Close()
return data, err
}

Expand Down Expand Up @@ -946,7 +950,7 @@ func (s3 *S3) run(req *request, resp interface{}) (*http.Response, error) {
log.Printf("} -> %s\n", dump)
}
if hresp.StatusCode != 200 && hresp.StatusCode != 204 {
hresp.Body.Close()
defer hresp.Body.Close()
return nil, buildError(hresp)
}
if resp != nil {
Expand Down

0 comments on commit ff3d9a6

Please sign in to comment.