Skip to content

Commit

Permalink
UDP Proxy filter: Add test case for remove cluster with active session.
Browse files Browse the repository at this point in the history
  • Loading branch information
railwaycat committed Dec 5, 2024
1 parent 6d65dd9 commit 52eddf2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/extensions/filters/udp/udp_proxy/udp_proxy_filter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,18 @@ stat_prefix: foo
expectSessionCreate(upstream_address_);
test_sessions_[0].expectWriteToUpstream("hello", 0, nullptr, true);
recvDataFromDownstream("10.0.0.1:1000", "10.0.0.2:80", "hello");

// Push a new cluster again, we expect this to trigger active session removal.
{
NiceMock<Upstream::MockThreadLocalCluster> other_thread_local_cluster;
other_thread_local_cluster.cluster_.info_->name_ = "fake_cluster";
Upstream::ThreadLocalClusterCommand command =
[&other_thread_local_cluster]() -> Upstream::ThreadLocalCluster& {
return other_thread_local_cluster;
};
cluster_update_callbacks_->onClusterAddOrUpdate(other_thread_local_cluster.info()->name(),
command);
}
}

// Hitting the maximum per-cluster connection/session circuit breaker.
Expand Down

0 comments on commit 52eddf2

Please sign in to comment.