-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.go
103 lines (96 loc) · 2.2 KB
/
app.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
package main
import (
"time"
"github.com/urfave/cli"
)
func s3bFlags() []cli.Flag {
return []cli.Flag{
cli.StringFlag{
Name: "server, s",
Usage: "Target S3 server to test",
EnvVar: "S3_SERVER",
},
cli.StringFlag{
Name: "region, r",
Usage: "S3 server region to use",
EnvVar: "S3_REGION",
Value: "us-east-1",
},
cli.StringFlag{
Name: "access-key, A",
Usage: "Access Key to the S3 server",
EnvVar: "S3_ACCESS_KEY",
},
cli.StringFlag{
Name: "secret-key, R",
Usage: "Access Key to the S3 server",
EnvVar: "S3_SECRET_KEY",
},
cli.StringFlag{
Name: "api-signature, a",
Usage: "API Signature version (v2 or v4)",
EnvVar: "S3_API_SIGNATURE",
Value: "v4",
},
cli.BoolFlag{
Name: "SSL, S",
Usage: "Whether or not to use SSL to connect to the S3 server",
EnvVar: "S3_SSL",
},
cli.BoolFlag{
Name: "debug, d",
Usage: "Print debug HTTP tracing information",
EnvVar: "S3_DEBUG",
},
cli.StringFlag{
Name: "statsd, D",
Usage: "StatsD server to which metrics will be sent",
EnvVar: "S3_STATSD_HOST",
Value: "s3b",
},
cli.StringFlag{
Name: "prefix, p",
Usage: "Prefix to use with the StatsD metrics",
EnvVar: "S3_STATSD_PREFIX",
},
cli.BoolFlag{
Name: "datadog, G",
Usage: "Whether or not to assume we are connecting to DogStasD and use DataDog style tags",
EnvVar: "S3_DATADOG",
},
cli.StringFlag{
Name: "matrix, m",
Usage: "Comma separated key value pairs of filename=size to use in the testing.",
EnvVar: "S3_TEST_MATRIX",
},
cli.StringFlag{
Name: "matrix-dir, M",
Usage: "Directory containing the files to be used for testing.",
EnvVar: "S3_TEST_MATRIX_DIR",
},
}
}
func s3bAction(c *cli.Context) error {
// Initialize environment
testMatrix := initializeEnvironment(c)
// Run tests
for {
runTest(testMatrix)
}
}
func s3bApp() *cli.App {
app := cli.NewApp()
app.Name = "s3b"
app.Usage = "S3/Object Store benchmarking tool"
app.Version = "0.0.1"
app.Compiled = time.Now()
app.Authors = []cli.Author{
{
Name: "Juan L. Negron",
Email: "[email protected]",
},
}
app.Flags = s3bFlags()
app.Action = s3bAction
return app
}