Skip to content
Draft

Flake #41606

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,15 @@ class ClientSideWeightedRoundRobinIntegrationTest

for (uint64_t i = 0; i < number_of_requests; i++) {
ENVOY_LOG(trace, "Before request {}.", i);

absl::SleepFor(absl::Milliseconds(10));
codec_client_ = makeHttpConnection(lookupPort("http"));

Http::TestRequestHeaderMapImpl request_headers{
{":method", "GET"}, {":path", "/"}, {":scheme", "http"}, {":authority", "example.com"}};

auto response = codec_client_->makeRequestWithBody(request_headers, 0);

auto upstream_index = waitForNextUpstreamRequest({0, 1, 2});
auto upstream_index = waitForNextUpstreamRequest({0, 1, 2}, std::chrono::seconds(15));
ASSERT(upstream_index.has_value());
upstream_usage[upstream_index.value()]++;

Expand All @@ -146,8 +146,8 @@ class ClientSideWeightedRoundRobinIntegrationTest

EXPECT_TRUE(upstream_request_->complete());
EXPECT_TRUE(response->complete());

cleanupUpstreamAndDownstream();
ASSERT_TRUE(codec_client_->waitForDisconnect());
ENVOY_LOG(trace, "After request {}.", i);
}
}
Expand Down Expand Up @@ -541,6 +541,7 @@ class ClientSideWeightedRoundRobinEdsIntegrationTest

for (uint64_t i = 0; i < number_of_requests; i++) {
ENVOY_LOG(trace, "Before request {}.", i);
absl::SleepFor(absl::Milliseconds(10));

codec_client_ = makeHttpConnection(lookupPort("http"));

Expand All @@ -550,8 +551,9 @@ class ClientSideWeightedRoundRobinEdsIntegrationTest
{":authority", "example.com"}};

auto response = codec_client_->makeRequestWithBody(request_headers, 0);
absl::SleepFor(absl::Milliseconds(10));

auto upstream_index = waitForNextUpstreamRequest(upstream_indices);
auto upstream_index = waitForNextUpstreamRequest(upstream_indices, std::chrono::seconds(30));
ASSERT(upstream_index.has_value());
upstream_usage[upstream_index.value()]++;

Expand All @@ -568,6 +570,8 @@ class ClientSideWeightedRoundRobinEdsIntegrationTest
EXPECT_TRUE(response->complete());

cleanupUpstreamAndDownstream();
ASSERT_TRUE(codec_client_->waitForDisconnect());

ENVOY_LOG(trace, "After request {}.", i);
}
}
Expand Down Expand Up @@ -724,19 +728,21 @@ TEST_P(ClientSideWeightedRoundRobinEdsIntegrationTest, AddRemoveLocality) {
Config::getTypeUrl<envoy::config::endpoint::v3::ClusterLoadAssignment>(),
{current_endpoints}, {}, {"cluster_1"}, "2");

ENVOY_LOG(error, "before initial_usage");

// Upstream QPS for ORCA load reports. All hosts report the same QPS.
const std::vector<uint64_t> upstream_qps = {100, 100, 100, 100};
// Send 100 requests to cluster1 so host weights are updated.
// Send 10 requests to cluster1 so host weights are updated.
std::vector<uint64_t> initial_usage;
sendRequestsAndTrackUpstreamUsage(FirstUpstreamIndex, upstream_qps, 10, initial_usage);
ENVOY_LOG(trace, "initial_usage {}", initial_usage);
ENVOY_LOG(error, "initial_usage {}", initial_usage);

EXPECT_EQ(i + 1, test_server_->counter("cluster.cluster_1.membership_change")->value());

// Send another 100 requests to cluster1, expecting weights to be used.
// Send another 20 requests to cluster1, expecting weights to be used.
std::vector<uint64_t> upstream_usage;
sendRequestsAndTrackUpstreamUsage(FirstUpstreamIndex, upstream_qps, 100, upstream_usage);
ENVOY_LOG(trace, "upstream_usage {}", upstream_usage);
sendRequestsAndTrackUpstreamUsage(FirstUpstreamIndex, upstream_qps, 20, upstream_usage);
ENVOY_LOG(error, "upstream_usage {}", upstream_usage);
// Expect the usage of first locality to be non-zero.
EXPECT_GT(upstream_usage[0], 0);
EXPECT_GT(upstream_usage[1], 0);
Expand Down