func InitCommandLineFlags(config config.Config) { config.IntVar(¶ms.iterations, "iterations", 1, "number of pushes to attempt") config.IntVar(¶ms.concurrency, "concurrency", 1, "max number of pushes to attempt in parallel") config.BoolVar(¶ms.silent, "silent", false, "true to run the commands and print output the terminal") config.StringVar(¶ms.output, "output", "", "if specified, writes benchmark results to a CSV file") config.StringVar(¶ms.workload, "workload", "", "The set of operations a user should issue (ex. login,push,push)") config.IntVar(¶ms.interval, "interval", 0, "repeat a workload at n second interval, to be used with -stop") config.IntVar(¶ms.stop, "stop", 0, "stop a repeating interval after n second, to be used with -interval") config.StringVar(¶ms.csvDir, "csvDir", "output/csvs", "Directory to Store CSVs") restContext.DescribeParameters(config) }
func (c *Context) DescribeParameters(config config.Config) { config.StringVar(&c.target, "rest:target", "", "the target for the REST api") config.StringVar(&c.username, "rest:username", "", "username for REST api") config.StringVar(&c.password, "rest:password", "", "password for REST api") }
func InitCommandLineFlags(flags config.Config) { flags.StringVar(¶ms.csvDir, "csvDir", "output/csvs", "Directory to Store CSVs") }
package pat_test import ( . "github.com/julz/pat" "github.com/julz/pat/benchmarker" "github.com/julz/pat/config" "github.com/julz/pat/experiment" "github.com/julz/pat/laboratory" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("Cmdline", func() { var ( flags config.Config args []string lab *dummyLab worker benchmarker.Worker ) JustBeforeEach(func() { flags = config.NewConfig() InitCommandLineFlags(flags) flags.Parse(args) lab = &dummyLab{} worker = benchmarker.NewWorker() RunCommandLineWithLabAndWorker(lab, worker) }) Describe("When -iterations is supplied", func() { BeforeEach(func() { args = []string{"-iterations", "3"}