Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic when specified value of payloads or threads min is greater than value of max #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
19 changes: 10 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 All @@ -162,11 +163,11 @@ func parseFlags() {
createBucket = *createBucketArg

if payloadsMin > payloadsMax {
payloadsMin = payloadsMax
panic("Value of the payloadsMin should not be greater than value of the payloadsMax.")
}

if threadsMin > threadsMax {
threadsMin = threadsMax
panic("Value of the threadsMin should not be greater than value of the threadsMax.")
}

if *fullArg {
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