From bd57c9ca5b4422bfbb8b6f09a2bfbfd96948cda9 Mon Sep 17 00:00:00 2001 From: Gyuho Lee Date: Thu, 11 Jan 2018 03:06:51 -0800 Subject: [PATCH] etcd-tester: fix "writeTxn" key selection Found when debugging https://github.com/coreos/etcd/issues/9130. Signed-off-by: Gyuho Lee --- tools/functional-tester/etcd-tester/key_stresser.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/functional-tester/etcd-tester/key_stresser.go b/tools/functional-tester/etcd-tester/key_stresser.go index f4ab77906..08a74279a 100644 --- a/tools/functional-tester/etcd-tester/key_stresser.go +++ b/tools/functional-tester/etcd-tester/key_stresser.go @@ -225,7 +225,7 @@ func writeTxn(kvc pb.KVClient, keys []string, txnOps int) stressFunc { return func(ctx context.Context) (error, int64) { ks := make(map[string]struct{}, txnOps) for len(ks) != txnOps { - ks[keys[rand.Intn(64)]] = struct{}{} + ks[keys[rand.Intn(len(keys))]] = struct{}{} } selected := make([]string, 0, txnOps) for k := range ks {