Fix Interaction Model end-to-end testing failure (#4596)
diff --git a/src/app/CommandSender.cpp b/src/app/CommandSender.cpp
index 40eeea7..5569cf4 100644
--- a/src/app/CommandSender.cpp
+++ b/src/app/CommandSender.cpp
@@ -41,7 +41,8 @@
// Create a new exchange context.
// TODO: temprary create a SecureSessionHandle from node id, will be fix in PR 3602
- mpExchangeCtx = mpExchangeMgr->NewContext({ aNodeId, Transport::kAnyKeyId }, this);
+ // TODO: Hard code keyID to 0 to unblock IM end-to-end test. Complete solution is tracked in issue:4451
+ mpExchangeCtx = mpExchangeMgr->NewContext({ aNodeId, 0 }, this);
VerifyOrExit(mpExchangeCtx != nullptr, err = CHIP_ERROR_NO_MEMORY);
mpExchangeCtx->SetResponseTimeout(CHIP_INVOKE_COMMAND_RSP_TIMEOUT);
diff --git a/src/app/tests/integration/chip_im_initiator.cpp b/src/app/tests/integration/chip_im_initiator.cpp
index 3f9dfc2..b3facc8 100644
--- a/src/app/tests/integration/chip_im_initiator.cpp
+++ b/src/app/tests/integration/chip_im_initiator.cpp
@@ -224,7 +224,8 @@
// Connection has been established. Now send the CommandRequests.
for (unsigned int i = 0; i < kMaxCommandCount; i++)
{
- if (SendCommandRequest() != CHIP_NO_ERROR)
+ err = SendCommandRequest();
+ if (err != CHIP_NO_ERROR)
{
printf("Send request failed: %s\n", chip::ErrorStr(err));
break;
@@ -252,7 +253,7 @@
ShutdownChip();
exit:
- if (err != CHIP_NO_ERROR)
+ if ((err != CHIP_NO_ERROR) || (gCommandRespCount != kMaxCommandCount))
{
printf("ChipCommandSender failed: %s\n", chip::ErrorStr(err));
exit(EXIT_FAILURE);
diff --git a/src/app/tests/integration/chip_im_responder.cpp b/src/app/tests/integration/chip_im_responder.cpp
index 672c0e0..125c295 100644
--- a/src/app/tests/integration/chip_im_responder.cpp
+++ b/src/app/tests/integration/chip_im_responder.cpp
@@ -44,7 +44,8 @@
// The CommandHandler object
chip::TransportMgr<chip::Transport::UDP> gTransportManager;
chip::SecureSessionMgr gSessionManager;
-chip::SecurePairingUsingTestSecret gTestPairing;
+chip::SecurePairingUsingTestSecret gTestPairing(chip::Optional<chip::NodeId>::Value(chip::kUndefinedNodeId),
+ static_cast<uint16_t>(0), static_cast<uint16_t>(0));
// Callback handler when a CHIP EchoRequest is received.
void HandleCommandRequestReceived(chip::TLV::TLVReader & aReader, chip::app::Command * apCommandObj)