Skip to content

Commit

Permalink
add --disable-multipart flag to allow testing without multipart (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
harshavardhana authored Apr 30, 2020
1 parent 87b642f commit dfa46a6
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 136 deletions.
10 changes: 5 additions & 5 deletions cli/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,14 @@ func clientTransport(ctx *cli.Context) http.RoundTripper {
tr := &http.Transport{
Proxy: http.ProxyFromEnvironment,
DialContext: (&net.Dialer{
Timeout: 5 * time.Second,
KeepAlive: 5 * time.Second,
Timeout: 10 * time.Second,
KeepAlive: 10 * time.Second,
}).DialContext,
MaxIdleConnsPerHost: ctx.Int("concurrent"),
IdleConnTimeout: 90 * time.Second,
TLSHandshakeTimeout: 10 * time.Second,
ExpectContinueTimeout: 1 * time.Second,
ResponseHeaderTimeout: time.Minute,
TLSHandshakeTimeout: 15 * time.Second,
ExpectContinueTimeout: 10 * time.Second,
ResponseHeaderTimeout: 2 * time.Minute,
// Set this value so that the underlying transport round-tripper
// doesn't try to auto decode the body of objects with
// content-encoding set to `gzip`.
Expand Down
5 changes: 5 additions & 0 deletions cli/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ var (
Value: 100,
Usage: "Number of DELETE operations per batch.",
},
cli.BoolFlag{
Name: "disable-multipart",
Usage: "disable multipart uploads",
},
}
)

Expand Down Expand Up @@ -80,6 +84,7 @@ func mainDelete(ctx *cli.Context) error {
Location: "",
PutOpts: minio.PutObjectOptions{
ServerSideEncryption: newSSE(ctx),
DisableMultipart: ctx.Bool("disable-multipart"),
},
},
CreateObjects: ctx.Int("objects"),
Expand Down
5 changes: 5 additions & 0 deletions cli/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ var (
Value: "10MiB",
Usage: "Size of each generated object. Can be a number or 10KiB/MiB/GiB. All sizes are base 2 binary.",
},
cli.BoolFlag{
Name: "disable-multipart",
Usage: "disable multipart uploads",
},
}
)

Expand Down Expand Up @@ -74,6 +78,7 @@ func mainGet(ctx *cli.Context) error {
Location: "",
PutOpts: minio.PutObjectOptions{
ServerSideEncryption: sse,
DisableMultipart: ctx.Bool("disable-multipart"),
},
},
CreateObjects: ctx.Int("objects"),
Expand Down
5 changes: 5 additions & 0 deletions cli/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ var (
Value: "1KB",
Usage: "Size of each generated object. Can be a number or 10KB/MB/GB. All sizes are base 2 binary.",
},
cli.BoolFlag{
Name: "disable-multipart",
Usage: "disable multipart uploads",
},
}
)

Expand Down Expand Up @@ -74,6 +78,7 @@ func mainList(ctx *cli.Context) error {
Location: "",
PutOpts: minio.PutObjectOptions{
ServerSideEncryption: newSSE(ctx),
DisableMultipart: ctx.Bool("disable-multipart"),
},
},
CreateObjects: ctx.Int("objects"),
Expand Down
5 changes: 5 additions & 0 deletions cli/mixed.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ var (
Usage: "The amount of DELETE operations. Must be at least the same as PUT.",
Value: 10,
},
cli.BoolFlag{
Name: "disable-multipart",
Usage: "disable multipart uploads",
},
}
)

Expand Down Expand Up @@ -107,6 +111,7 @@ func mainMixed(ctx *cli.Context) error {
Location: "",
PutOpts: minio.PutObjectOptions{
ServerSideEncryption: sse,
DisableMultipart: ctx.Bool("disable-multipart"),
},
},
CreateObjects: ctx.Int("objects"),
Expand Down
11 changes: 9 additions & 2 deletions cli/put.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ var (
Value: "10MiB",
Usage: "Size of each generated object. Can be a number or 10KiB/MiB/GiB. All sizes are base 2 binary.",
},
cli.BoolFlag{
Name: "disable-multipart",
Usage: "disable multipart uploads",
},
}
)

Expand Down Expand Up @@ -60,15 +64,18 @@ EXAMPLES:
func mainPut(ctx *cli.Context) error {
checkPutSyntax(ctx)
src := newGenSource(ctx)

sse := newSSE(ctx)
b := bench.Put{
Common: bench.Common{
Client: newClient(ctx),
Concurrency: ctx.Int("concurrent"),
Source: src,
Bucket: ctx.String("bucket"),
Location: "",
PutOpts: minio.PutObjectOptions{},
PutOpts: minio.PutObjectOptions{
ServerSideEncryption: sse,
DisableMultipart: ctx.Bool("disable-multipart"),
},
},
}
return runBench(ctx, &b)
Expand Down
5 changes: 5 additions & 0 deletions cli/select.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ var (
Value: "select * from s3object",
Usage: "select query expression",
},
cli.BoolFlag{
Name: "disable-multipart",
Usage: "disable multipart uploads",
},
}
)

Expand Down Expand Up @@ -78,6 +82,7 @@ func mainSelect(ctx *cli.Context) error {
Location: "",
PutOpts: minio.PutObjectOptions{
ServerSideEncryption: sse,
DisableMultipart: ctx.Bool("disable-multipart"),
},
},
CreateObjects: ctx.Int("objects"),
Expand Down
5 changes: 5 additions & 0 deletions cli/stat.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ var (
Value: "1KB",
Usage: "Size of each generated object. Can be a number or 10KB/MB/GB. All sizes are base 2 binary.",
},
cli.BoolFlag{
Name: "disable-multipart",
Usage: "disable multipart uploads",
},
}
)

Expand Down Expand Up @@ -75,6 +79,7 @@ func mainStat(ctx *cli.Context) error {
Location: "",
PutOpts: minio.PutObjectOptions{
ServerSideEncryption: sse,
DisableMultipart: ctx.Bool("disable-multipart"),
},
},
CreateObjects: ctx.Int("objects"),
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ require (
github.com/klauspost/compress v1.10.3
github.com/minio/cli v1.22.0
github.com/minio/mc v0.0.0-20200201185513-ac9b9423973b
github.com/minio/minio v0.0.0-20200409163002-f44cfb2863a1
github.com/minio/minio-go/v6 v6.0.52
github.com/minio/minio v0.0.0-20200430053134-c7470e6e6eed
github.com/minio/minio-go/v6 v6.0.55
github.com/pkg/profile v1.3.0
github.com/posener/complete v1.2.2-0.20190702141536-6ffe496ea953
github.com/secure-io/sio-go v0.3.0
Expand Down
Loading

0 comments on commit dfa46a6

Please sign in to comment.