Skip to content

Commit f211e8b

Browse files
marktrayerchulspros-gatti
authored
[Camera] Fix TC_WEBRTC_1_6 failure on not finding any WebRTC session to close (#43565) (#43578)
* Fix TC_WEBRTC_1_6.py failure by ignoring NOT_FOUND status response on invoking EndSession The test case was failing as EndSession is called at step 9. Since on closing the browser popup, the peer connection gets closed. Some implementations can remove the session in CurrentSessions attribute on peer connection state switching to Closed/Disconnected. Hence it update TC_WEBRTC_1_6.py to ignore any NOT_FOUND status response for EndSession command. * Address review comment: Silence only NotFound interaction response --------- Signed-off-by: s-gatti <s.gatti@samsung.com> Signed-off-by: Charles Kim <chulspro.kim@samsung.com> Co-authored-by: chulspro <chulspro.kim@samsung.com> Co-authored-by: s-gatti <s.gatti@samsung.com>
1 parent c2f80b7 commit f211e8b

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

src/python_testing/TC_WEBRTC_1_6.py

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@
2323
from matter.ChipDeviceCtrl import TransportPayloadCapability
2424
from matter.clusters import CameraAvStreamManagement, Objects, WebRTCTransportProvider
2525
from matter.clusters.Types import NullValue
26-
from matter.testing.matter_testing import MatterBaseTest, TestStep, default_matter_test_main, has_feature, run_if_endpoint_matches
26+
from matter.interaction_model import InteractionModelError, Status
27+
from matter.testing.decorators import has_feature, run_if_endpoint_matches
28+
from matter.testing.matter_testing import MatterBaseTest
29+
from matter.testing.runner import TestStep, default_matter_test_main
2730
from matter.webrtc import BrowserPeerConnection, WebRTCManager
2831

2932

@@ -213,13 +216,20 @@ async def _run_test_steps(self, webrtc_manager: WebRTCManager, webrtc_peer: Brow
213216
self.user_verify_two_way_talk("Verify if two way talk back is working")
214217

215218
self.step(9)
216-
await self.send_single_cmd(
217-
cmd=WebRTCTransportProvider.Commands.EndSession(
218-
webRTCSessionID=session_id, reason=Objects.Globals.Enums.WebRTCEndReasonEnum.kUserHangup
219-
),
220-
endpoint=endpoint,
221-
payloadCapability=TransportPayloadCapability.LARGE_PAYLOAD,
222-
)
219+
try:
220+
await self.send_single_cmd(
221+
cmd=WebRTCTransportProvider.Commands.EndSession(
222+
webRTCSessionID=session_id, reason=Objects.Globals.Enums.WebRTCEndReasonEnum.kUserHangup
223+
),
224+
endpoint=endpoint,
225+
payloadCapability=TransportPayloadCapability.LARGE_PAYLOAD,
226+
)
227+
except InteractionModelError as e:
228+
# Since on closing the browser popup, the PC state changes to Disconnected/Closed.
229+
# Some implementations can remove session from CurrentSessions on connection state
230+
# switching to Disconnected/Closed. Hence ignore NotFound status response.
231+
if (e.status != Status.NotFound):
232+
raise
223233

224234
if dut_has_vdo_feature:
225235
self.step(10)

0 commit comments

Comments
 (0)