Merge pull request #16123 from serathius/robustness-txn-key-prefix

tests/robustness: Fix multi txn key prefix
This commit is contained in:
Marek Siarkowicz 2023-06-22 20:37:56 +02:00 committed by GitHub
commit 6fd77ac613
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -277,7 +277,7 @@ func (c etcdTrafficClient) pickMultiTxnOps() (ops []clientv3.Op) {
}
for i, opType := range opTypes {
key := fmt.Sprintf("%d", keys[i])
key := c.key(keys[i])
switch opType {
case model.RangeOperation:
ops = append(ops, clientv3.OpGet(key))
@ -294,7 +294,11 @@ func (c etcdTrafficClient) pickMultiTxnOps() (ops []clientv3.Op) {
}
func (c etcdTrafficClient) randomKey() string {
return fmt.Sprintf("%s%d", c.keyPrefix, rand.Int()%c.keyCount)
return c.key(rand.Int())
}
func (c etcdTrafficClient) key(i int) string {
return fmt.Sprintf("%s%d", c.keyPrefix, i%c.keyCount)
}
func (t etcdTraffic) pickOperationType() model.OperationType {