Skip to content

Commit

Permalink
Test fix: ensure we don't accidentally generate two identical histogr…
Browse files Browse the repository at this point in the history
…ams (elastic#113322)

* Test fix: looks like using one value is not random enough
  • Loading branch information
smalyshev committed Sep 23, 2024
1 parent a443d47 commit a0ac2bd
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class CCSTelemetrySnapshotTests extends AbstractWireSerializingTestCase<C

private LongMetricValue randomLongMetricValue() {
LongMetric v = new LongMetric();
for (int i = 0; i < randomIntBetween(1, 10); i++) {
for (int i = 0; i < randomIntBetween(5, 10); i++) {
v.record(randomIntBetween(0, 1_000_000));
}
return v.getValue();
Expand Down Expand Up @@ -110,13 +110,13 @@ protected CCSTelemetrySnapshot mutateInstance(CCSTelemetrySnapshot instance) thr
}
break;
case 3:
took = randomLongMetricValue();
took = randomValueOtherThan(took, this::randomLongMetricValue);
break;
case 4:
tookMrtTrue = randomLongMetricValue();
tookMrtTrue = randomValueOtherThan(tookMrtTrue, this::randomLongMetricValue);
break;
case 5:
tookMrtFalse = randomLongMetricValue();
tookMrtFalse = randomValueOtherThan(tookMrtFalse, this::randomLongMetricValue);
break;
case 6:
skippedRemotes += randomNonNegativeLong();
Expand Down

0 comments on commit a0ac2bd

Please sign in to comment.