Skip to content

Commit f0421d2

Browse files
fixed test case and number to hex
1 parent 5e5127f commit f0421d2

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

xds/src/main/java/io/grpc/xds/WeightedRoundRobinLoadBalancer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ static final class StaticStrideScheduler {
348348
private final int sizeDivisor;
349349
private final Random random;
350350
private final AtomicInteger sequence;
351-
private static final int K_MAX_WEIGHT = 65535;
351+
private static final int K_MAX_WEIGHT = 0xFFFF;
352352
private static final long UINT32_MAX = 0xFFFF_FFFFL;
353353

354354
StaticStrideScheduler(float[] weights, Random random) {

xds/src/test/java/io/grpc/xds/WeightedRoundRobinLoadBalancerTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,8 +1084,8 @@ public void testManyComplexWeights2() {
10841084
pickCount.put(result, pickCount.getOrDefault(result, 0) + 1);
10851085
}
10861086
for (int i = 0; i < 8; i++) {
1087-
assertThat(Math.abs(pickCount.getOrDefault(i, 0) / 10000.0 - weights[i] / totalWeight) )
1088-
.isAtMost(2);
1087+
assertThat(Math.abs(pickCount.getOrDefault(i, 0) / 1000.0 - weights[i] / totalWeight) )
1088+
.isAtMost(0.01);
10891089
}
10901090
}
10911091

0 commit comments

Comments
 (0)