Skip to content

Commit 52eddf2

Browse files
committed
UDP Proxy filter: Add test case for remove cluster with active session.
1 parent 6d65dd9 commit 52eddf2

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/extensions/filters/udp/udp_proxy/udp_proxy_filter_test.cc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -927,6 +927,18 @@ stat_prefix: foo
927927
expectSessionCreate(upstream_address_);
928928
test_sessions_[0].expectWriteToUpstream("hello", 0, nullptr, true);
929929
recvDataFromDownstream("10.0.0.1:1000", "10.0.0.2:80", "hello");
930+
931+
// Push a new cluster again, we expect this to trigger active session removal.
932+
{
933+
NiceMock<Upstream::MockThreadLocalCluster> other_thread_local_cluster;
934+
other_thread_local_cluster.cluster_.info_->name_ = "fake_cluster";
935+
Upstream::ThreadLocalClusterCommand command =
936+
[&other_thread_local_cluster]() -> Upstream::ThreadLocalCluster& {
937+
return other_thread_local_cluster;
938+
};
939+
cluster_update_callbacks_->onClusterAddOrUpdate(other_thread_local_cluster.info()->name(),
940+
command);
941+
}
930942
}
931943

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

0 commit comments

Comments
 (0)