Переглянути джерело

Merge pull request #4883 from heyitsanthony/fix-4874

integration: don't call rand.Intn in TestSTMConflict on 0
Anthony Romano 9 роки тому
батько
коміт
fc346041e5
1 змінених файлів з 4 додано та 0 видалено
  1. 4 0
      integration/v3_stm_test.go

+ 4 - 0
integration/v3_stm_test.go

@@ -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))