Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified build/darwin-amd64/s3-benchmark
Binary file not shown.
Binary file modified build/linux-amd64/s3-benchmark
Binary file not shown.
Binary file modified build/linux-arm64/s3-benchmark
Binary file not shown.
Binary file modified build/windows-amd64/s3-benchmark.exe
Binary file not shown.
23 changes: 23 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
github.com/aws/aws-sdk-go-v2 v0.7.0 h1:a5xRI/tBmUFKuAA0SOyEY2P1YhQb+jVOEI9P/7KfrP0=
github.com/aws/aws-sdk-go-v2 v0.7.0/go.mod h1:17MaCZ9g0q5BIMxwzRQeiv8M3c8+W7iuBnlWAEprcxE=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/gucumber/gucumber v0.0.0-20180127021336-7d5c79e832a2/go.mod h1:YbdHRK9ViqwGMS0rtRY+1I6faHvVyyurKPIPwifihxI=
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM=
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
github.com/mitchellh/colorstring v0.0.0-20150917214807-8631ce90f286 h1:KHyL+3mQOF9sPfs26lsefckcFNDcIZtiACQiECzIUkw=
github.com/mitchellh/colorstring v0.0.0-20150917214807-8631ce90f286/go.mod h1:l0dey0ia/Uv7NcFFVbCLtqEBQbrT4OCwCSKTEv6enCw=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/schollz/progressbar/v2 v2.0.0-20190307141100-7e454dc2feed h1:AOPbpyqE1ZGt5TjROyF+C8hL1EJ/tCjz1Uko8yRyqt4=
github.com/schollz/progressbar/v2 v2.0.0-20190307141100-7e454dc2feed/go.mod h1:l6tn6yU6ZdQoF8lwX/VoAUQ3FjhCbrcZDnl9xeWZzYw=
github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644/go.mod h1:nkxAfR/5quYxwPZhyDxgasBMnRtBZd0FCEpawpjMUFg=
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
21 changes: 12 additions & 9 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@ import (
"encoding/csv"
"flag"
"fmt"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/aws/external"
"github.com/aws/aws-sdk-go-v2/service/s3"
"github.com/schollz/progressbar/v2"
"io"
"io/ioutil"
"net/http"
"os"
"sort"
"strings"
"time"

"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/aws/external"
"github.com/aws/aws-sdk-go-v2/service/s3"
"github.com/schollz/progressbar/v2"
)

// represents the duration from making an S3 GetObject request to getting the first byte and last byte
Expand Down Expand Up @@ -136,7 +137,7 @@ func parseFlags() {
cleanupArg := flag.Bool("cleanup", false, "Cleans all the objects uploaded to S3 for this test.")
csvResultsArg := flag.String("upload-csv", "", "Uploads the test results to S3 as a CSV file.")
createBucketArg := flag.Bool("create-bucket", true, "Create the bucket")

// parse the arguments and set all the global variables accordingly
flag.Parse()

Expand Down Expand Up @@ -227,7 +228,7 @@ func setup() {
},
})

// AWS S3 has this peculiar issue in which if you want to create bucket in us-east-1 region, you should NOT specify
// AWS S3 has this peculiar issue in which if you want to create bucket in us-east-1 region, you should NOT specify
// any location constraint. https://github.com/boto/boto3/issues/125
if strings.ToLower(region) == "us-east-1" {
createBucketReq = s3Client.CreateBucketRequest(&s3.CreateBucketInput{
Expand All @@ -240,7 +241,7 @@ func setup() {
// if the error is because the bucket already exists, ignore the error
if err != nil && !strings.Contains(err.Error(), "BucketAlreadyOwnedByYou:") {
panic("Failed to create S3 bucket: " + err.Error())
}
}
}

// an object size iterator that starts from 1 KB and doubles the size on every iteration
Expand Down Expand Up @@ -598,8 +599,10 @@ func cleanup() {
_, err := headReq.Send()

// if the object doesn't exist, ignore the error
if err != nil && !strings.HasPrefix(err.Error(), "NotFound: Not Found") {
panic("Failed to delete object: " + err.Error())
if err != nil {
if s3Err, ok := err.(s3.RequestFailure); !ok || s3Err.Code() != "NoSuchKey" {
panic("Failed to delete object: " + err.Error())
}
}
}
}
Expand Down