integration: don't call rand.Intn in TestSTMConflict on 0

Fixes #4874
This commit is contained in:
Anthony Romano 2016-03-28 13:06:07 -07:00
parent 2b83d9c2e5
commit 384c3ec907

View File

@ -53,6 +53,10 @@ func TestSTMConflict(t *testing.T) {
dst := stm.Get(dstKey)
srcV, _ := strconv.ParseInt(src, 10, 64)
dstV, _ := strconv.ParseInt(dst, 10, 64)
if srcV == 0 {
// can't rand.Intn on 0, so skip this transaction
return nil
}
xfer := int64(rand.Intn(int(srcV)) / 2)
stm.Put(srcKey, fmt.Sprintf("%d", srcV-xfer))
stm.Put(dstKey, fmt.Sprintf("%d", dstV+xfer))