Skip to content

Commit 8583d2f

Browse files
fix flaky race test
1 parent 815e4cf commit 8583d2f

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

internal/xds/resolver/cluster_specifier_plugin_test.go

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,8 +393,26 @@ func (s) TestResolverClusterSpecifierPluginRefCountRace(t *testing.T) {
393393
t.Fatalf("Config selector returned cluster %q, want %q", got, want)
394394
}
395395

396-
// Move the route to cspB. cspA is now held only by the in-flight RPC.
396+
// Move the route to cspB. cspA is now held only by the in-flight RPC, so
397+
// both plugins stay in the service config. Waiting for that config matters:
398+
// it confirms the client processed this update before the race below, and
399+
// without it the next update could coalesce with this one and leave the
400+
// route config unchanged from the client's point of view.
397401
configureResources(ctx, t, mgmtServer, nodeID, listeners, routeConfigForPlugin("cspB", "anythingB"), nil, nil)
402+
verifyUpdateFromResolver(ctx, t, stateCh, `{
403+
"loadBalancingConfig": [{
404+
"xds_cluster_manager_experimental": {
405+
"children": {
406+
"cluster_specifier_plugin:cspA": {
407+
"childPolicy": [{"csp_experimental": {"arbitrary_field": "anythingA"}}]
408+
},
409+
"cluster_specifier_plugin:cspB": {
410+
"childPolicy": [{"csp_experimental": {"arbitrary_field": "anythingB"}}]
411+
}
412+
}
413+
}
414+
}]
415+
}`)
398416

399417
// Commit the RPC, dropping cspA's last reference, while an update naming
400418
// cspA again is pushed concurrently. The two orderings exercise different

0 commit comments

Comments
 (0)