Skip to content

Commit

Permalink
changefeedccl: fix TestAvroSchema/DECIMAL flake
Browse files Browse the repository at this point in the history
The precision is really meant to be in [1,10], but it sure looks like
there's an off by one error in the avro library that makes this test
flake if it picks precision of 1.

Release note: None
  • Loading branch information
danhhz committed Oct 9, 2018
1 parent b494a48 commit 004c6cb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/ccl/changefeedccl/avro_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,10 @@ func TestAvroSchema(t *testing.T) {
datum = tree.MakeDTimestamp(t, time.Microsecond)
case sqlbase.ColumnType_DECIMAL:
// TODO(dan): Make RandDatum respect Precision and Width instead.
typ.Precision = rng.Int31n(10) + 1
// TODO(dan): The precision is really meant to be in [1,10], but it
// sure looks like there's an off by one error in the avro library
// that makes this test flake if it picks precision of 1.
typ.Precision = rng.Int31n(10) + 2
typ.Width = rng.Int31n(typ.Precision + 1)
coeff := rng.Int63n(int64(math.Pow10(int(typ.Precision))))
datum = &tree.DDecimal{Decimal: *apd.New(coeff, -typ.Width)}
Expand Down

0 comments on commit 004c6cb

Please sign in to comment.