diff --git a/t/auto-daemon-tests-player-cache.pl b/t/auto-daemon-tests-player-cache.pl index f6071dac5..1308f50b7 100755 --- a/t/auto-daemon-tests-player-cache.pl +++ b/t/auto-daemon-tests-player-cache.pl @@ -8,6 +8,7 @@ use NGCP::Rtpengine::AutoTest; use Test::More; use NGCP::Rtpclient::ICE; use POSIX; +use JSON; $ENV{RTPENGINE_EXTENDED_TESTS} or exit(); # timing sensitive tests @@ -33,7 +34,7 @@ my $pcma_5 = "\xad\xac\xa2\xa6\xbd\x9a\x06\x3f\x26\x2d\x2c\x2d\x26\x3f\x06\x9a\x my ($sock_a, $sock_b, $sock_c, $sock_d, $port_a, $port_b, $ssrc, $ssrc_b, $resp, - $sock_ax, $sock_bx, $port_ax, $port_bx, + $sock_ax, $sock_bx, $port_ax, $port_bx, @cids, $srtp_ctx_a, $srtp_ctx_b, $srtp_ctx_a_rev, $srtp_ctx_b_rev, $ufrag_a, $ufrag_b, @ret1, @ret2, @ret3, @ret4, $srtp_key_a, $srtp_key_b, $ts, $seq, $has_recv); @@ -43,6 +44,8 @@ my ($sock_a, $sock_b, $sock_c, $sock_d, $port_a, $port_b, $ssrc, $ssrc_b, $resp, ($sock_a) = new_call([qw(198.51.100.1 2040)]); +push(@cids, cid()); + offer('media playback, opus', { ICE => 'remove', replace => ['origin'] }, < 'remove', replace => ['origin'] }, < 'remove', replace => ['origin'] }, < 'remove', replace => ['origin'] }, < 'remove', replace => ['origin'] }, < 'remove', replace => ['origin'], label => 'foobar' }, < 'remove', replace => ['origin'], label => 'quux' }, < 'remove', replace => ['origin'], DTLS => 'off' }, < 'remove', replace => ['origin'], 'rtcp-mux' => ['demux'], 'via-branch' => 'xxxx', flags => ['strict-source', 'record-call'], 'transport-protocol' => 'RTP/AVP' }, <{statistics}{currentstatistics}{mediacache}, 0, "no media cache"; +is $resp->{statistics}{currentstatistics}{playercache}, 966, "player cache size"; + +$resp = rtpe_req('cli', 'clear cache', { body => 'media evict players' }); + +$resp = rtpe_req('statistics', 'check stats again', { }); +is $resp->{statistics}{currentstatistics}{mediacache}, 0, "no media cache"; +is $resp->{statistics}{currentstatistics}{playercache}, 966, "references held by calls"; + + +for my $cid (@cids) { + rtpe_req("delete", "delete all calls", { 'call-id' => $cid, 'delete delay' => 0 }); +} + +$resp = rtpe_req('statistics', 'check stats again', { }); +is $resp->{statistics}{currentstatistics}{mediacache}, 0, "no media cache"; +is $resp->{statistics}{currentstatistics}{playercache}, 0, "no more player cache"; + #done_testing;NGCP::Rtpengine::AutoTest::terminate('f00');exit;