@@ -1190,13 +1190,17 @@ public void metrics() {
11901190 verifyLongCounterRecord ("grpc.lb.wrr.endpoint_weight_not_yet_usable" , 1 , 2 );
11911191 verifyLongCounterRecord ("grpc.lb.wrr.endpoint_weight_not_yet_usable" , 1 , 3 );
11921192
1193- // Send each child LB state an ORCA update with some valid utilization/qps data so that weights
1194- // can be calculated.
1193+ // Send one child LB state an ORCA update with some valid utilization/qps data so that weights
1194+ // can be calculated, but it's still essentially round_robin
11951195 Iterator <ChildLbState > childLbStates = wrr .getChildLbStates ().iterator ();
11961196 ((WeightedChildLbState )childLbStates .next ()).new OrcaReportListener (
11971197 weightedConfig .errorUtilizationPenalty ).onLoadReport (
11981198 InternalCallMetricRecorder .createMetricReport (0.1 , 0 , 0.1 , 1 , 0 , new HashMap <>(),
11991199 new HashMap <>(), new HashMap <>()));
1200+
1201+ fakeClock .forwardTime (1 , TimeUnit .SECONDS );
1202+
1203+ // Now send a second child LB state an ORCA update, so there's real weights
12001204 ((WeightedChildLbState )childLbStates .next ()).new OrcaReportListener (
12011205 weightedConfig .errorUtilizationPenalty ).onLoadReport (
12021206 InternalCallMetricRecorder .createMetricReport (0.1 , 0 , 0.1 , 1 , 0 , new HashMap <>(),
@@ -1210,9 +1214,15 @@ public void metrics() {
12101214 // weights were updated
12111215 reset (mockMetricRecorder );
12121216
1213- // We go forward in time past the default 10s blackout period before weights can be considered
1214- // for wrr. The eights would get updated as the default update interval is 1s.
1215- fakeClock .forwardTime (11 , TimeUnit .SECONDS );
1217+ // We go forward in time past the default 10s blackout period for the first child. The weights
1218+ // would get updated as the default update interval is 1s.
1219+ fakeClock .forwardTime (9 , TimeUnit .SECONDS );
1220+
1221+ verifyLongCounterRecord ("grpc.lb.wrr.rr_fallback" , 1 , 1 );
1222+
1223+ // And after another second the other children have weights
1224+ reset (mockMetricRecorder );
1225+ fakeClock .forwardTime (1 , TimeUnit .SECONDS );
12161226
12171227 // Since we have weights on all the child LB states, the weight update should not result in
12181228 // further rr_fallback metric entries.
0 commit comments