diff --git a/tools/functional-tester/etcd-runner/command/global.go b/tools/functional-tester/etcd-runner/command/global.go index b03d13171..80b941f7e 100644 --- a/tools/functional-tester/etcd-runner/command/global.go +++ b/tools/functional-tester/etcd-runner/command/global.go @@ -26,8 +26,13 @@ import ( ) var ( - rounds int - totalClientConnections int + rounds int // total number of rounds the operation needs to be performed + totalClientConnections int // total number of client connections to be made with server + noOfPrefixes int // total number of prefixes which will be watched upon + watchPerPrefix int // number of watchers per prefix + reqRate int // put request per second + totalKeys int // total number of keys for operation + runningTime time.Duration // time for which operation should be performed ) // GlobalFlags are flags that defined globally diff --git a/tools/functional-tester/etcd-runner/command/watch_command.go b/tools/functional-tester/etcd-runner/command/watch_command.go index 87b9a665a..fe9ab279b 100644 --- a/tools/functional-tester/etcd-runner/command/watch_command.go +++ b/tools/functional-tester/etcd-runner/command/watch_command.go @@ -36,6 +36,11 @@ func NewWatchCommand() *cobra.Command { Run: runWatcherFunc, } cmd.Flags().IntVar(&rounds, "rounds", 100, "number of rounds to run") + cmd.Flags().DurationVar(&runningTime, "running-time", 60, "number of seconds to run") + cmd.Flags().IntVar(&noOfPrefixes, "total-prefixes", 10, "total no of prefixes to use") + cmd.Flags().IntVar(&watchPerPrefix, "watch-per-prefix", 10, "number of watchers per prefix") + cmd.Flags().IntVar(&reqRate, "req-rate", 30, "rate at which put request will be performed") + cmd.Flags().IntVar(&totalKeys, "total-keys", 1000, "total number of keys to watch") return cmd } @@ -52,14 +57,9 @@ func runWatcherFunc(cmd *cobra.Command, args []string) { } func performWatchOnPrefixes(ctx context.Context, cmd *cobra.Command, round int) { - runningTime := 60 * time.Second // time for which operation should be performed - noOfPrefixes := 36 // total number of prefixes which will be watched upon - watchPerPrefix := 10 // number of watchers per prefix - reqRate := 30 // put request per second - keyPrePrefix := 30 // max number of keyPrePrefixs for put operation - + keyPerPrefix := totalKeys / noOfPrefixes prefixes := stringutil.UniqueStrings(5, noOfPrefixes) - keys := stringutil.RandomStrings(10, keyPrePrefix) + keys := stringutil.RandomStrings(10, keyPerPrefix) roundPrefix := fmt.Sprintf("%16x", round) @@ -82,7 +82,7 @@ func performWatchOnPrefixes(ctx context.Context, cmd *cobra.Command, round int) } revision = gr.Header.Revision - ctxt, cancel := context.WithDeadline(ctx, time.Now().Add(runningTime)) + ctxt, cancel := context.WithDeadline(ctx, time.Now().Add(runningTime*time.Second)) defer cancel() // generate and put keys in cluster diff --git a/tools/functional-tester/etcd-runner/main.go b/tools/functional-tester/etcd-runner/main.go index 89e0abaf4..82dbc309f 100644 --- a/tools/functional-tester/etcd-runner/main.go +++ b/tools/functional-tester/etcd-runner/main.go @@ -24,8 +24,8 @@ import ( ) const ( - cliName = "etcdctl" - cliDescription = "A simple command line client for etcd3." + cliName = "etcd-runner" + cliDescription = "Stress tests using clientv3 functionality.." defaultDialTimeout = 2 * time.Second ) @@ -38,7 +38,7 @@ var ( rootCmd = &cobra.Command{ Use: cliName, Short: cliDescription, - SuggestFor: []string{"etcdctl"}, + SuggestFor: []string{"etcd-runner"}, } )