diff --git a/test/integration/http_subset_lb_integration_test.cc b/test/integration/http_subset_lb_integration_test.cc index 603c903b86e1..84a2bd956846 100644 --- a/test/integration/http_subset_lb_integration_test.cc +++ b/test/integration/http_subset_lb_integration_test.cc @@ -137,11 +137,13 @@ class HttpSubsetLbIntegrationTest : public testing::TestWithParam hosts; - for (int i = 0; i < n; i++) { + for (int i = 0; i < m; i++) { Http::TestHeaderMapImpl response_headers{{":status", "200"}}; // Send header only request. @@ -160,6 +162,12 @@ class HttpSubsetLbIntegrationTest : public testing::TestWithParamvalue() .getStringView()); + + if (i >= n && (is_hash_lb_ || hosts.size() > 1)) { + // Once we've completed n iterations, quit for hash lb policies. For others, keep going + // until we've seen multiple hosts (as expected) or reached m iterations. + break; + } } if (is_hash_lb_) {